Skip to content

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

Open
MazterQyou wants to merge 1 commit intomasterfrom
cubesql/filtered-view-measure
Open

feat(cubesql): Support PatchMeasure for view measures#10571
MazterQyou wants to merge 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.

Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
@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 90.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.56%. Comparing base (ef1ab6d) to head (a027fb0).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...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 ⚠️
...sql/src/compile/rewrite/rules/wrapper/aggregate.rs 97.95% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10571      +/-   ##
==========================================
- Coverage   83.40%   78.56%   -4.84%     
==========================================
  Files         250      474     +224     
  Lines       75196    92801   +17605     
  Branches        0     3611    +3611     
==========================================
+ Hits        62718    72913   +10195     
- Misses      12478    19343    +6865     
- Partials        0      545     +545     
Flag Coverage Δ
cube-backend 57.80% <71.42%> (?)
cubesql 83.41% <97.95%> (+<0.01%) ⬆️

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.

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.

1 participant