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 2022/12/02 14:38:07 UTC

[GitHub] [calcite] dssysolyatin commented on a diff in pull request #2977: [CALCITE-5388] No result when using ROW_NUMBER in two common table expressions

dssysolyatin commented on code in PR #2977:
URL: https://github.com/apache/calcite/pull/2977#discussion_r1038206955


##########
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java:
##########
@@ -693,7 +696,7 @@ private static Pair<Expression, Expression> getPartitionIterator(
     }
     Expression multiMap_ =
         builder.append(
-            "multiMap", Expressions.new_(SortedMultiMap.class));
+            "multiMap", Expressions.new_(SortedMultiMap.class), false);

Review Comment:
   @libenchao @rubenada As I wrote above "multiMap" case works without this fix. 
   But it works only because expressions which create and fill multiMap are different. 
   I set optimize flag = true for "multiMap" only for safety, because it is really easy to make a mistake here. 
   I am not against optimizations, but in my opinion, this optimization does more harm than good. 
   
   ```
   Pseudo code for "multiMap" case
   <-- first EnumerableWindow -->
   multiMap = new SortedMultiMap() <-- luckely optimizer caches only this expression
   fillMultimap(multiMap)
   multiMap.clear()
   
   <-- second EnumerableWindow -->
   fillMap(multiMap)
   multiMap.clear()
   ```



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