Skip to content

fix(schema-compiler): Use join paths from pre-aggregation declaration instead of building join tree from scratch #9471

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

Merged
merged 15 commits into from
Apr 22, 2025

Conversation

mcheshkov
Copy link
Member

Check List

  • Tests have been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Description of Changes Made (if issue reference is not provided)

Take 2 for #9431, now with more tests and fixes in pre-aggregations matching

Without this pre-aggregatoin declaration would build a list of members, and build join tree from scratch. New join tree could be different, and pre-aggregation would contain incorrect data.

Add join hints to member adapters, to build join tree with proper members. This is more of a hack than proper solution: join tree would still disallow to have same cube twice with different join paths.
Just adding extra join hints on query level does not work because of FKQA and multiplication check in subqueries: we have to know join path for every member, so it should be either explicit or unambigous for each member.

Join tree from query is still not included in pre-aggregation matching, so user would have to manually ensure that views and pre-aggregations both match each other and does not produce false matches

For now, only pre-aggregation itself respects join paths, but pre-aggregation matching does same as before: strips join path from pre-aggregation references and compares members directly.

@mcheshkov mcheshkov force-pushed the pre-agg-join-path-take-2 branch from b38d3b6 to fd7e96a Compare April 15, 2025 12:50
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 32 lines in your changes missing coverage. Please review.

Project coverage is 59.07%. Comparing base (fed08e1) to head (2bb6df8).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...cubejs-schema-compiler/src/compiler/CubeSymbols.ts 22.72% 16 Missing and 1 partial ⚠️
...es/cubejs-schema-compiler/src/adapter/BaseQuery.js 58.33% 10 Missing ⚠️
...ejs-schema-compiler/src/adapter/PreAggregations.js 86.95% 3 Missing ⚠️
...bejs-schema-compiler/src/compiler/CubeEvaluator.ts 60.00% 1 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (fed08e1) and HEAD (2bb6df8). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (fed08e1) HEAD (2bb6df8)
cubesql 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #9471       +/-   ##
===========================================
- Coverage   80.54%   59.07%   -21.47%     
===========================================
  Files         382      153      -229     
  Lines       96521    13017    -83504     
  Branches     2192     2202       +10     
===========================================
- Hits        77739     7690    -70049     
+ Misses      18471     5014    -13457     
- Partials      311      313        +2     
Flag Coverage Δ
cube-backend 59.07% <66.66%> (+0.09%) ⬆️
cubesql ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcheshkov mcheshkov marked this pull request as ready for review April 15, 2025 13:50
@mcheshkov mcheshkov requested review from a team as code owners April 15, 2025 13:50
@bsod90 bsod90 requested a review from KSDaemon April 21, 2025 17:24
@ovr ovr requested a review from waralexrom April 21, 2025 18:44
Copy link
Member

@KSDaemon KSDaemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@mcheshkov mcheshkov force-pushed the pre-agg-join-path-take-2 branch from fd7e96a to 9698ca6 Compare April 22, 2025 10:19
… instead of building join tree from scratch (#9431)

Without this pre-aggregatoin declaration would build a list of members, and build join tree from scratch. New join tree could be different, and pre-aggregation would contain incorrect data.

Add join hints to member adapters, to build join tree with proper members. This is more of a hack than proper solution: join tree would still disallow to have same cube twice with different join paths.
Just adding extra join hints on query level does not work because of FKQA and multiplication check in subqueries: we have to know join path for every member, so it should be either explicit or unambigous _for each member_.

Join tree from query is still not included in pre-aggregation matching, so user would have to manually ensure that views and pre-aggregations both match each other and does not produce false matches

(cherry picked from commit aea3a6c)
@mcheshkov mcheshkov force-pushed the pre-agg-join-path-take-2 branch from 9698ca6 to 2bb6df8 Compare April 22, 2025 10:20
@mcheshkov mcheshkov merged commit cd7e9fd into master Apr 22, 2025
59 checks passed
@mcheshkov mcheshkov deleted the pre-agg-join-path-take-2 branch April 22, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants