You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/02/22 12:42:31 UTC

[GitHub] [calcite] thomasrebele commented on a change in pull request #2302: [CALCITE-4437] The Sort rel should be decorrelated even though it has fetch or limit when it is not inside a Correlate (Thomas Rebele)

thomasrebele commented on a change in pull request #2302:
URL: https://github.com/apache/calcite/pull/2302#discussion_r580220147



##########
File path: core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
##########
@@ -429,7 +430,7 @@ protected RexNode removeCorrelationExpr(
         ImmutableSortedMap.of());
   }
 
-  public @Nullable Frame decorrelateRel(Sort rel) {
+  public @Nullable Frame decorrelateRel(Sort rel, boolean isCorVarDefined) {
     //

Review comment:
       Indeed, @rubenada's example needs to be taken care of if we would remove the isCorVarDefined. By passing it as an parameter we avoid such subtle problems. We could translate it to an attribute and wrap the code that changes the attribute in a try-finally block:
   
   ```
   boolean prevCorVarDefined = isCorVarDefined
   try {
       // ...
   }
   finally {
       isCorVarDefined = prevCorVarDefined;
   }
   ```
   I'm slightly leaning towards using a parameter, which looks a bit cleaner to me. Does anyone have another suggestions how to handle this variable?




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

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