iwanttobepowerful commented on PR #5031:
URL: https://github.com/apache/calcite/pull/5031#issuecomment-4756449353

   Thanks a lot for introducing SelectMany — this is a much cleaner abstraction 
than the current Correlate + Uncollect pattern.
   
   You mention in the description that "in the future this rewrite could be 
moved into SqlToRelConverter as well." Would it make sense to do (at least an 
initial version of) that directly in this PR?
   
   Concretely: in convertUnnest(), the array expressions and the input row are 
already available, so we could project the collection columns onto the input 
row and emit a LogicalSelectMany directly — without ever introducing a 
correlation variable. That would let FROM t CROSS/LEFT JOIN UNNEST(t.arr) skip 
the Correlate intermediate form (and the subsequent decorrelation step) 
entirely.
   
   To stay backwards-compatible, this could be gated behind a 
SqlToRelConverter.Config flag (off by default), mirroring the approach you took 
for the Correlate + Unnest → SelectMany rule.
   
   Happy to help with this if you think it's in scope for this PR — otherwise 
it could be a good follow-up.


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