cube-js / cube

📊 Cube — Universal semantic layer platform for AI, BI, spreadsheets, and embedded analytics
https://cube.dev
Other
17.96k stars 1.78k forks source link

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

Open mcheshkov opened 2 weeks ago

mcheshkov commented 2 weeks ago

Check List

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.

vercel[bot] commented 2 weeks ago

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](https://vercel.com/cube-dev/examples-angular-dashboard/6ydmhVbCg9UXW9X6yRJaxmuubRa3)) | [Visit Preview](https://examples-angular-dashboard-git-penalize-zero-me-83734a-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-d3** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-d3/HwMWRtgB5wmjEfu7ikA5D3UbHZN9)) | [Visit Preview](https://examples-react-d3-git-penalize-zero-members-in-wrapper-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-dashboard** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-dashboard/DEwQvuXiurY1iUWJ3YeFRHeNdb4r)) | [Visit Preview](https://examples-react-dashboard-git-penalize-zero-memb-a82d05-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-data-table** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-data-table/Hryy6vSnvD74JBMfb7He3JsyaCeP)) | [Visit Preview](https://examples-react-data-table-git-penalize-zero-mem-2f8dd2-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-highcharts** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-highcharts/Ax1Smu3yHfcUw5vWPqLKizp6rbdJ)) | [Visit Preview](https://examples-react-highcharts-git-penalize-zero-mem-68a1dc-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-material-ui** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-material-ui/8iskrDLsePc3Sg9pdzS8mQuvtF8U)) | [Visit Preview](https://examples-react-material-ui-git-penalize-zero-me-d3c1fb-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-react-pivot-table** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-react-pivot-table/HohvTw3V68W51gfgVMF35hQE5o5q)) | [Visit Preview](https://examples-react-pivot-table-git-penalize-zero-me-3ef722-cube-dev.vercel.app) | | Nov 13, 2024 0:13am | | **examples-vue-query-builder** | ⬜️ Ignored ([Inspect](https://vercel.com/cube-dev/examples-vue-query-builder/5Y9SGqTe5ysz2xbhRXjDaHZK6h5r)) | [Visit Preview](https://examples-vue-query-builder-git-penalize-zero-me-dc9574-cube-dev.vercel.app) | | Nov 13, 2024 0:13am |
codecov[bot] commented 1 week ago

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 :warning:
Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/cube-js/cube/pull/8927/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cube-js) | Coverage Δ | | |---|---|---| | [cubesql](https://app.codecov.io/gh/cube-js/cube/pull/8927/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cube-js) | `82.70% <97.82%> (+0.03%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cube-js#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.