You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "NobiGo (via GitHub)" <gi...@apache.org> on 2025/12/17 08:22:00 UTC

[PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

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

   …ing correlated sub-query within Filter or Join


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633293228


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   Yes. I missed it.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3664499645

   Is it possible that your proposed modifications can address this issue [CALCITE-7274](https://issues.apache.org/jira/browse/CALCITE-7274) ?
   


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "dssysolyatin (via GitHub)" <gi...@apache.org>.
dssysolyatin commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635790703


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   > However, if a subquery in the join condition uses a correlated variable (call it cor0) from the current scope, that cor0 is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the variablesSet concept in LogicalJoin, so the CorrelationId used by the subquery is not added to variablesSet. This explains why LogicalJoin.variablesSet is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Interesting, if we can transform such cases to ?
   ```
   LogicalCorrelate(correlation=[$cor0])
      LogicalJoin(condition=TRUE)
      LogicalFilter(condition=on_condition) 
   ```
   Or is it illegal ?



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2629223642


##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -3191,6 +3192,19 @@ public static List<RexSubQuery> collect(Project project) {
       }
       return subQueryCollector.subQueries;
     }
+
+    public static List<RexSubQuery> collect(Filter filter) {

Review Comment:
   I may not have explained it clearly, but that's roughly the idea.
   ```
   public static List<RexSubQuery> collect(RexNode rex) {
         SubQueryCollector subQueryCollector = new SubQueryCollector();
         rex.accept(subQueryCollector);
         return subQueryCollector.subQueries;
       }
   ```
   Just use it like:
   ```
   List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter.getCondition());
   List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(join.getCondition());
   ```



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2634384445


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Because during the SqlToRelConverter process, some correlation variables from subqueries cannot be fully extracted due to scope limitations, I am considering merging the correlation variables already present in the RelNode with those newly extracted from subqueries. WDYT?



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2632065578


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   If the plan is wrong it would be useful to have an issue about it.
   The trimmer should convert legal plans to legal equivalent plans - otherwise there is a bug in the trimmer as well.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635417739


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Correlated subqueries in join condition are a tricky issue (the case in [CALCITE-7274](https://issues.apache.org/jira/browse/CALCITE-7274)). Here's my understanding:
   
   According to the logic in `SqlToRelConverter` and `LogicalJoin`, the `variablesSet` of `LogicalJoin` describes the variables coming from the left input that are referenced in the right input. This is also confirmed by the logic of `RelBuilder` constructing a join: `RelBuilder.join` will produce a `Correlate` (not a `Join`) when it receives a non-empty `variablesSet`.
   
   However, if a subquery in the join condition uses a correlated variable (call it `cor0`) from the current scope, that `cor0` is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the `variablesSet` concept in `LogicalJoin`, so the CorrelationId used by the subquery is not added to `variablesSet`. This explains why `LogicalJoin.variablesSet` is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Back to this PR: based on the above, perhaps we should retain the original logic. For `Filter`, its `variablesSet` is correct in the first place; for `Join`, filling the `variablesSet` with the correlated variables used in the subquery of the condition contradicts the definition of `LogicalJoin.variablesSet`.
   
   This is my personal understanding and suggestion for your reference.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2629267265


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   I'm not sure if this works correctly when nested correlations. `RelOptUtil.getVariablesUsed` will return all CorrelationIds except those generated within the subquery, so `correlationIds` may be have multiple elements. For example:
   ```
   select deptno, right_q.ename from emp e1, LATERAL (
       select ename from emp e2 where exists(
           select * from emp e3 where e1.sal = e3.sal and e2.empno = e3.empno)) right_q
   
   LogicalProject(DEPTNO=[$7], ENAME=[$8])
     LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{5}])
       LogicalTableScan(table=[[scott, EMP]])
       LogicalProject(ENAME=[$1])
         LogicalFilter(condition=[EXISTS({       <--------
   LogicalFilter(condition=[AND(=($cor0.SAL, $5), =($cor1.EMPNO, $0))])
     LogicalTableScan(table=[[scott, EMP]])
   })], variablesSet=[[$cor1]])
           LogicalTableScan(table=[[scott, EMP]])
   ```
   



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633191002


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   > variablesSet should include cor0 and cor1.
   
   In my opinion, this plan is correct. `cor1` represents a variable from the input of LogicalFilter, so it is added to variablesSet. `cor0` represents the variable from the left side of LogicalCorrelate, which LogicalCorrelate has already recorded. `cor0` and `cor1` belong to different scopes. Adding `cor0` to the variablesSet of LogicalFilter would cause errors in removing subqueries and decorrelation.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635417739


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Correlated subqueries in join condition are a tricky issue. Here's my understanding:
   
   According to the logic in `SqlToRelConverter` and `LogicalJoin`, the `variablesSet` of `LogicalJoin` describes the variables coming from the left input that are referenced in the right input. This is also confirmed by the logic of `RelBuilder` constructing a join: `RelBuilder.join` will produce a `Correlate` (not a `Join`) when it receives a non-empty `variablesSet`.
   
   However, if a subquery in the join condition uses a correlated variable (call it `cor0`) from the current scope, that `cor0` is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the `variablesSet` concept in `LogicalJoin`, so the CorrelationId used by the subquery is not added to `variablesSet`. This explains why `LogicalJoin.variablesSet` is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables in join-condition subqueries as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Back to this PR: based on the above, we can keep the original logic for `Filter`, and for `Join` either leave its `variablesSet` unchanged or add the CorrelationIds used by subqueries — either option is fine. 
   
   This is my personal understanding and suggestion for your reference.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2634375090


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Hi @silundong , You can try CALCITE-7274, Then  you will know the RelNode is converted from SqlNode using SqlToRelConverter, this problem still occur.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "dssysolyatin (via GitHub)" <gi...@apache.org>.
dssysolyatin commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635790703


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   > However, if a subquery in the join condition uses a correlated variable (call it cor0) from the current scope, that cor0 is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the variablesSet concept in LogicalJoin, so the CorrelationId used by the subquery is not added to variablesSet. This explains why LogicalJoin.variablesSet is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Interesting, if we can we transform such cases to ?
   ```
   LogicalCorrelate(correlation=[$cor0])
      LogicalJoin(condition=TRUE)
      LogicalFilter(condition=on_condition) 
   ```
   Or is it illegal ?



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2629265479


##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -3191,6 +3192,19 @@ public static List<RexSubQuery> collect(Project project) {
       }
       return subQueryCollector.subQueries;
     }
+
+    public static List<RexSubQuery> collect(Filter filter) {

Review Comment:
   It's strange. The other method is Project, not an abstract level.This is not the main one. I think both of them are okay.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633264472


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Perhaps we should retain the original logic. `correlationIds` might contain free variables that don't belong to the current scope. 
   
   From the test cases below, it's indeed observed that this change corrects the issue of some nodes having missing variablesSet. However, the problem of missing variablesSet doesn't originate from RelFieldTrimmer; in my observation, it's usually caused by manually constructed plans. If RelNode is converted from SqlNode using SqlToRelConverter, this problem doesn't occur.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3676733299

   I have filed https://issues.apache.org/jira/browse/CALCITE-7340
   My proposal would be to actually prioritize solving that issue first; once we have a solution for it, this one may become easier too.


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2629282202


##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -3191,6 +3192,19 @@ public static List<RexSubQuery> collect(Project project) {
       }
       return subQueryCollector.subQueries;
     }
+
+    public static List<RexSubQuery> collect(Filter filter) {

Review Comment:
   I agree, it's fine.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3664292225

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691)
   
   


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635417739


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Correlated subqueries in join condition are a tricky issue (the case in [CALCITE-7274](https://issues.apache.org/jira/browse/CALCITE-7274)). Here's my understanding:
   
   According to the logic in `SqlToRelConverter` and `LogicalJoin`, the `variablesSet` of `LogicalJoin` describes the variables coming from the left input that are referenced in the right input. This is also confirmed by the logic of `RelBuilder` constructing a join: `RelBuilder.join` will produce a `Correlate` (not a `Join`) when it receives a non-empty `variablesSet`.
   
   However, if a subquery in the join condition uses a correlated variable (call it `cor0`) from the current scope, that `cor0` is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the `variablesSet` concept in `LogicalJoin`, so the CorrelationId used by the subquery is not added to `variablesSet`. This explains why `LogicalJoin.variablesSet` is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Back to this PR: based on the above, we can keep the original logic for `Filter`, and for `Join` either leave its `variablesSet` unchanged or add the CorrelationIds used by subqueries — either option is fine. 
   
   This is my personal understanding and suggestion for your reference.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635417739


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Correlated subqueries in join condition are a tricky issue. Here's my understanding:
   
   According to the logic in `SqlToRelConverter` and `LogicalJoin`, the `variablesSet` of `LogicalJoin` describes the variables coming from the left input that are referenced in the right input. This is also confirmed by the logic of `RelBuilder` constructing a join: `RelBuilder.join` will produce a `Correlate` (not a `Join`) when it receives a non-empty `variablesSet`.
   
   However, if a subquery in the join condition uses a correlated variable (call it `cor0`) from the current scope, that `cor0` is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the `variablesSet` concept in `LogicalJoin`, so the CorrelationId used by the subquery is not added to `variablesSet`. This explains why `LogicalJoin.variablesSet` is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Back to this PR: based on the above, we can keep the original logic for `Filter`, and for `Join` either leave its `variablesSet` unchanged or add the CorrelationIds used by subqueries — either option is fine. 
   
   This is my personal understanding and suggestion for your reference.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3709595263

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691)
   
   


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2631204019


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   This is a relatively complex SQL query, and the current PR likely does not address this. Additionally, there appears to be a problem with the logical plan shown above.
   ```
   LogicalProject(DEPTNO=[$7], ENAME=[$8])
     LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{5}])
       LogicalTableScan(table=[[scott, EMP]])
       LogicalProject(ENAME=[$1])
         LogicalFilter(condition=[EXISTS({       <--------
   LogicalFilter(condition=[AND(=**($cor0.SAL, $5)**, =**($cor1.EMPNO, $0)**)])
     LogicalTableScan(table=[[scott, EMP]])
   })], **variablesSet=[[$cor1]]**)
           LogicalTableScan(table=[[scott, EMP]])
   ```
   variablesSet should include cor0 and cor1.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3667938642

   > Is it possible that your proposed modifications can address this issue [CALCITE-7274](https://issues.apache.org/jira/browse/CALCITE-7274) ?
   
   It's a related issue; I'll check it.


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "dssysolyatin (via GitHub)" <gi...@apache.org>.
dssysolyatin commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635790703


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   > However, if a subquery in the join condition uses a correlated variable (call it cor0) from the current scope, that cor0 is intended to represent the concatenation of the left and right rows, not only variable originating from the left input. That interpretation does not match the variablesSet concept in LogicalJoin, so the CorrelationId used by the subquery is not added to variablesSet. This explains why LogicalJoin.variablesSet is always empty even though the join condition contains correlated variables from the current scope. In other words, we are forced to treat free variables used by subqueries in join condition as coming from the current scope rather than from outer scopes, which also causes problems with removing nested correlated subqueries and decorrelating them.
   
   Interesting, if we can we transform such cases to ? Or is it illegal ?
   ```
   LogicalCorrelate
      LogicalJoin(condition=TRUE)
      LogicalFilter(condition=on_condition) 
   ```



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3717514013

   After some preliminary PR fixes, this PR no longer requires additional code modifications, only test cases remain.


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo merged PR #4691:
URL: https://github.com/apache/calcite/pull/4691


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2635847076


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   As @julianhyde frequently says, the root of the problem is the lack of a precise specification of the structure of Rel programs that contain correlations. In the absence of a specification there is no way to decide what is a legal program and what its meaning is. In the paragraph above @silundong has tried to write a part of a specification.
   
   I think that this is the first step that should be made: write a spec of cor variables and variableSet, probably as a long JavaDoc comment, get it reviewed. Then write a second validator for Rel trees, which enforces these rules. That validator could be part of the builder API. Finally, once these rules are established, it will be much easier to decide where the problems lie with specific bugs.
   
   I will file a new JIRA issue about this.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2629210691


##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -3191,6 +3192,19 @@ public static List<RexSubQuery> collect(Project project) {
       }
       return subQueryCollector.subQueries;
     }
+
+    public static List<RexSubQuery> collect(Filter filter) {

Review Comment:
   Yes, it can indeed be converted into a RexNode here, but since Project is a List, the invocation could become complicated. Moreover, to maintain compatibility with the existing logic, I chose to extend this method instead.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "xiedeyantu (via GitHub)" <gi...@apache.org>.
xiedeyantu commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2626495253


##########
core/src/main/java/org/apache/calcite/rex/RexUtil.java:
##########
@@ -3191,6 +3192,19 @@ public static List<RexSubQuery> collect(Project project) {
       }
       return subQueryCollector.subQueries;
     }
+
+    public static List<RexSubQuery> collect(Filter filter) {

Review Comment:
   Would it be better to change the input parameter to RexNode? I find these two methods are very similar.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "silundong (via GitHub)" <gi...@apache.org>.
silundong commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633232249


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -634,7 +634,23 @@ public TrimResult trimFields(
     RelOptUtil.InputFinder inputFinder =
         new RelOptUtil.InputFinder(inputExtraFields, fieldsUsed);
     conditionExpr.accept(inputFinder);
-    final ImmutableBitSet inputFieldsUsed = inputFinder.build();
+
+    // Collect all the SubQueries in the filter condition.
+    List<RexSubQuery> subQueries = RexUtil.SubQueryCollector.collect(filter);
+    // Get all the correlationIds present in the SubQueries
+    Set<CorrelationId> correlationIds = RelOptUtil.getVariablesUsed(subQueries);
+    ImmutableBitSet requiredColumns = ImmutableBitSet.of();
+    if (!correlationIds.isEmpty()) {
+      // Correlation columns are also needed by SubQueries, so add them to inputFieldsUsed.
+      requiredColumns = RelOptUtil.correlationColumns(correlationIds.iterator().next(), filter);

Review Comment:
   > This is a relatively complex SQL query, and the current PR likely does not address this.
   
   This is indeed quite complex. As long as it doesn't lead to missing any columns, it's fine.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #4691:
URL: https://github.com/apache/calcite/pull/4691#discussion_r2633416767


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -673,7 +673,7 @@ public TrimResult trimFields(
 
     // Build new filter with trimmed input and condition.
     relBuilder.push(newInput)
-        .filter(filter.getVariablesSet(), newConditionExpr);
+        .filter(correlationIds, newConditionExpr);

Review Comment:
   Yes, I agree with your view. In principle, the RelNode constructed via RelNodeBuilder can be directly converted into SQL. However, I've found that some of the generated RelNodes cannot be converted. Regarding what you mentioned about the missing variablesSet—its maybe should merge these two—and the SQL test cases are also somewhat incomplete.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7336] RelFieldTrimmer generates an incorrect plan when handl… [calcite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4691:
URL: https://github.com/apache/calcite/pull/4691#issuecomment-3717528341

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4691&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4691&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4691&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4691)
   
   


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org