Skip to content

feat: lower CASE WHEN in the planner to CaseExpr - #2661

Open
rishitesh-snt wants to merge 1 commit into
feat/case-exprfrom
feat/case-planner
Open

rishitesh-snt wants to merge 1 commit into
feat/case-exprfrom
feat/case-planner

Conversation

@rishitesh-snt

Copy link
Copy Markdown
Contributor

Rationale for this change

Wires CASE WHEN through the planner so SQL queries can use it. The proof
primitive lands in #2659; this PR only lowers the DataFusion Expr::Case node
onto it.

What changes are included in this PR?

  • expr.rs lowers searched (CASE WHEN c THEN v ...) and simple
    (CASE x WHEN v THEN ...) forms to DynProofExpr::try_new_case, and collects
    column references for CASE.
  • CASE without ELSE is rejected at planning time (implicit NULL has no
    representation).

Are these changes tested?

Yes. End-to-end prove/verify (case_when_matrix_tests.rs) for numeric,
multi-arm (up to 4 conditions), varchar, nested, and conditional-aggregation
CASE, plus planning-time rejection tests.

Stacked on #2659 (the CaseExpr primitive); review/merge that first.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.41%. Comparing base (f0929d8) to head (75e3127).

Files with missing lines Patch % Lines
crates/proof-of-sql-planner/src/expr.rs 66.00% 17 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           feat/case-expr    #2661      +/-   ##
==================================================
- Coverage           96.46%   96.41%   -0.06%     
==================================================
  Files                 295      294       -1     
  Lines               52922    52608     -314     
==================================================
- Hits                51053    50723     -330     
- Misses               1869     1885      +16     

☔ View full report in Codecov by Harness.
📢 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.

Lowers searched and simple CASE forms to DynProofExpr::try_new_case. CASE
without ELSE is rejected (implicit NULL has no representation). Stacked on the
CaseExpr primitive PR.
@github-actions

Copy link
Copy Markdown

This PR has been marked as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

@github-actions github-actions Bot added stale and removed stale labels Aug 28, 2026
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