Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing cubeSize should not create a new Revision #346

Open
Jiaweihu08 opened this issue Jul 16, 2024 · 1 comment
Open

Changing cubeSize should not create a new Revision #346

Jiaweihu08 opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels
type: enhancement Improvement of existing feature or code

Comments

@Jiaweihu08
Copy link
Member

Jiaweihu08 commented Jul 16, 2024

Why

This feature will allow the adjustment of cubeSize over time without creating new Revisions.

Theory

In theory, the domain-driven maxWeight estimation allows changing cube sizes: Wc = Wpc + dcs / Dc without impacting the integrity of the index, as cube domains are not dependent on the cube size. However, existing files must be rewritten for better adherence to the index via qbeastTable.optimize.

A closer examination of Wc = Wpc + dcs / Dc reveals that Wc is directly proportional to dcs - any change done to dcs will be reflected in the cube maxWeight in the same proportions:

Index:
        r
      /    \
     b      a
              \
               aa

Wr = dcs / Dr;
Wa = Wr + dcs / Da;
Waa = Wa + dcs / Daa;

Waa = Wa + dcs / Daa
= (Wr + dcs / Da) + dcs / Daa
= ((dcs / Dr) + dcs / Da) + dcs / Daa
= dcs / Dr + dcs / Da + dcs / Daa
= dcs (1 / Dr + 1 / Da + 1 / Daa)

In other words, multiplying the desiredCubSize(dcs) by any factor f will result in a new weight Waa_new = Waa * f; halving the desiredCubeSize will divide all weights by 2.

Impact

If the cubeSize is reduced, weight ranges will shift to the left, increasing cube offsets - elements e | e.w > cube.maxWeight.

On the other hand, if cubeSize is increased, weight ranges will move to the right; some elements that before belonged to c will have to be relocated to some ancestor cube.

All these adjustments will be handled automatically when optimizing via qbeastTable.optimize().

@Jiaweihu08 Jiaweihu08 added the type: bug Something isn't working label Jul 16, 2024
@Jiaweihu08 Jiaweihu08 self-assigned this Jul 16, 2024
@Jiaweihu08 Jiaweihu08 added type: enhancement Improvement of existing feature or code and removed type: bug Something isn't working labels Jul 16, 2024
@fpj
Copy link
Contributor

fpj commented Oct 21, 2024

We discussed in the product backlog curation call and determined that it needs further investigation to understand what the implementation entails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing feature or code
Projects
None yet
Development

No branches or pull requests

2 participants