Skip to content

feat(cubesql): Support PatchMeasure for view measures#10571

Merged
MazterQyou merged 1 commit intomasterfrom
cubesql/filtered-view-measure
Mar 31, 2026
Merged

feat(cubesql): Support PatchMeasure for view measures#10571
MazterQyou merged 1 commit intomasterfrom
cubesql/filtered-view-measure

Conversation

@MazterQyou
Copy link
Copy Markdown
Member

Check List

  • Tests have been run in packages where changes have been 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

This PR adds support for PatchMeasure member expressions to resolve filters in view measures.

This allows using expressions like SELECT AVG(CASE dimension WHEN 'value' THEN measure END) on measures in views, not just cubes.

Additionally, a new rewrite rule is added to handle simpler syntax: AGG_FUN(CASE WHEN filter_expr THEN measure END).

Related test is included.

@MazterQyou MazterQyou requested review from a team as code owners March 27, 2026 14:45
@github-actions github-actions bot added rust Pull requests that update Rust code javascript Pull requests that update Javascript code labels Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 82.30769% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.57%. Comparing base (defc186) to head (2883d16).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...sql/src/compile/rewrite/rules/wrapper/aggregate.rs 85.84% 15 Missing ⚠️
...es/cubejs-schema-compiler/src/adapter/BaseQuery.js 76.47% 4 Missing ⚠️
.../cubejs-schema-compiler/src/adapter/BaseMeasure.ts 50.00% 0 Missing and 2 partials ⚠️
rust/cubesql/cubesql/src/transport/ext.rs 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #10571       +/-   ##
===========================================
+ Coverage   57.86%   78.57%   +20.71%     
===========================================
  Files         225      475      +250     
  Lines       17562    92822    +75260     
  Branches     3610     3612        +2     
===========================================
+ Hits        10162    72937    +62775     
- Misses       6856    19340    +12484     
- Partials      544      545        +1     
Flag Coverage Δ
cube-backend 57.87% <71.42%> (+<0.01%) ⬆️
cubesql 83.41% <84.40%> (?)

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.

Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
@MazterQyou MazterQyou force-pushed the cubesql/filtered-view-measure branch from db892be to 2883d16 Compare March 30, 2026 23:39
@MazterQyou MazterQyou merged commit 3bfe812 into master Mar 31, 2026
126 of 127 checks passed
@MazterQyou MazterQyou deleted the cubesql/filtered-view-measure branch March 31, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants