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

feat(cubesql): Penalize zero members in wrapper #8927

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mcheshkov
Copy link
Member

Check List

  • Tests has 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)

This would allow to extract fully assembled CubeScan under wrapper instead of CubeScan(allMembers, ungrouped=true).

ATM there are two related components in cost: non_detected_cube_scans and cube_members
non_detected_cube_scans allows to penalize CubeScan without members specifically outside the wrapper. This is pretty hard penalty, queries like that are Not Good™
cube_members allows to prefer queries will less members, which seems fine. But on it's own it would prefer query with zero member, which is, actually, all the members.
So, new cost component added: zero_members_wrapper. It would stand right before cube_members, and allow to penalize no-members representation before cube_members starts impacting extraction.

New CubeScan extractions surfaced a couple of bugs related to aliasing in generated SQL, hence all the supporting stuff in this PR.

@mcheshkov mcheshkov force-pushed the penalize-zero-members-in-wrapper branch from eca2925 to da51ec9 Compare November 7, 2024 17:16
Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-angular-dashboard ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2024 0:13am

@mcheshkov mcheshkov marked this pull request as ready for review November 7, 2024 22:36
@mcheshkov mcheshkov requested review from a team as code owners November 7, 2024 22:36
* Now column names, introudced by Datafusion, would get renamed, and that would avoid sending too long aliases to Cube for SQL generation, and later to data source
* Single CubeScan can represent join of multiple TableScans, they can have different table aliases, and columns on top of CubeScan can have different qualifiers. But generated SQL can have only one table alias, so all column expressions on top needs to be remapped as well
@mcheshkov mcheshkov force-pushed the penalize-zero-members-in-wrapper branch from da51ec9 to 6376543 Compare November 13, 2024 12:13
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 97.82609% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.70%. Comparing base (5fd13d1) to head (6376543).

Files with missing lines Patch % Lines
...t/cubesql/cubesql/src/compile/engine/df/wrapper.rs 96.68% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8927      +/-   ##
==========================================
+ Coverage   82.66%   82.70%   +0.03%     
==========================================
  Files         221      221              
  Lines       78303    78455     +152     
==========================================
+ Hits        64726    64883     +157     
+ Misses      13577    13572       -5     
Flag Coverage Δ
cubesql 82.70% <97.82%> (+0.03%) ⬆️

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.

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.

1 participant