bvolpato opened a new pull request, #5241:
URL: https://github.com/apache/calcite/pull/5241

   ## Jira Link
   
   Pending issue creation and linkage. This PR is a draft.
   
   ## Changes Proposed
   
   A SEMI JOIN with a singleton left input currently becomes a filter and 
projection over the right input. If several right rows match, the rewrite 
returns the left row once per match instead of once overall.
   
   Exclude SEMI joins from the left-singleton simplification, including the 
Project-over-Values variant. Add regressions for both shapes. Right-singleton 
SEMI joins retain their existing optimization.
   
   ## Reproduction
   
   Join left `VALUES (1)` to right `VALUES (1), (1)` with a SEMI equality join. 
The original join returns one row; the affected rewrite returns two.
   
   ```sh
   ./gradlew :core:test --tests 
'org.apache.calcite.test.RelOptRulesTest.testSemiJoinWithConstantRowOnLeft' 
--tests 
'org.apache.calcite.test.RelOptRulesTest.testSemiJoinWithProjectOnConstantRowOnLeft'
   ```
   
   ## Validation
   
   - A compiled-source HepPlanner/Interpreter reproduction returns two rows 
before the fix and one after, for both left-side rule variants.
   - Both right-side rule variants still optimize and preserve their results.
   - Both exact planner regression methods pass against the checked-in XML 
snapshots and fail against the baseline rule.
   - `./gradlew autostyleApply` and `git diff --check` pass.
   - Focused runs used freshly compiled changed classes with cached supporting 
artifacts. Native Gradle test-class compilation on pristine `main` was blocked 
by `java.io.IOException: No space left on device`; the full Gradle build has 
not been validated locally.
   
   ## Downsides
   
   This disables the invalid simplification for left-singleton SEMI joins. A 
separate existence-preserving rewrite could recover that optimization later.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to