[ 
https://issues.apache.org/jira/browse/CALCITE-7045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17954912#comment-17954912
 ] 

Stamatis Zampetakis commented on CALCITE-7045:
----------------------------------------------

In fact, my main problem with having multiple correlates with the same 
correlation id is that the semantics are not (well?) defined. Hopefully, having 
unique ids should lead to plans with cleaner semantics since scoping and other 
kind of questions will not be relevant.

One thing to consider though is if the current situation is somehow convenient 
for decorrelation or other purposes. Assuming that we have a filter with a 
correlation and two correlates with the same id. Would it be valid/possible to 
pull the filter above the deepest correlate and remove completely one 
correlation? I guess we should take into account this kind of questions in the 
final decision.

> Generate unique correlationId for each correlate node
> -----------------------------------------------------
>
>                 Key: CALCITE-7045
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7045
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: suibianwanwan
>            Priority: Major
>
> As discussed in 
> [https://lists.apache.org/thread/l5ls7hxmrkp6vqqmffxs4cq4dnv95x36] :
> Currently in SubQueryRemove, new Correlates are created based on the 
> CorrelationId from the original RelNode. When this subQuery requires multiple 
> Correlate expansions or when multiple subQueries share the same CorrelationId 
> and are expanded separately, multiple Correlates with identical CorrelationId 
> may be generated.
> This can cause difficulties during Decorrelate processing and lead to errors 
> in some scenarios.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to