venkata91 commented on PR #28127:
URL: https://github.com/apache/flink/pull/28127#issuecomment-4435641481

   **Note on why this PR uses a custom rule rather than Calcite's stock 
`ProjectCorrelateTransposeRule`:**
   
   With both [CALCITE-7511](https://issues.apache.org/jira/browse/CALCITE-7511) 
merged in Calcite (`$cor0.X` renumbering when pushing `Project` through 
`Correlate` over a `TableFunctionScan`) and 
[FLINK-39669](https://issues.apache.org/jira/browse/FLINK-39669) merged in 
Flink (preserve right-side projection in `BatchPhysicalCorrelateRule` / 
`StreamPhysicalCorrelateRule` when a `Calc` sits between `Correlate` and 
`TableFunctionScan`), this PR could be significantly simplified — wire 
Calcite's stock `ProjectCorrelateTransposeRule` into `PROJECT_RULES` and let it 
prune both sides.
   
   We side-stepped that path because picking up CALCITE-7511 requires a Calcite 
version bump, which has historically been slow and painful in Flink. Rather 
than gate this work on an uncertain upgrade timeline, this PR adds a custom 
`FlinkProjectCorrelateUnnestTransposeRule` that works around CALCITE-7511 
directly (does its own `$cor0.X` renumbering on the `TableFunctionScan` 
rexCall) and currently prunes the **left side** of the UNNEST `Correlate`. 
Right-side pruning is deferred to a follow-up gated on FLINK-39669 landing; the 
custom rule remains even then (the CALCITE-7511 workaround is still needed), 
but its scope grows to cover the full transformation that Calcite's stock rule 
would have done.


-- 
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