[
https://issues.apache.org/jira/browse/CALCITE-7045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17955010#comment-17955010
]
Mihai Budiu commented on CALCITE-7045:
--------------------------------------
there are two possible approaches:
* have a generator that always generates fresh ids, e.g., using a counter
* use a visitor to detect ids in use and generate fresh ones when needed
In our compiler we use the first approach; rel nodes have similar ids I
believe. If you want the ids to be "dense" you can also implement a visitor to
"compact" all the corrids that appear in a plan in two passes, by collecting a
set of all used ids and renaming them 0, 1, 2, etc. This could be used before
printing plans, to ensure that most of the plans displayed today don't change.
> 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)