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 2020/01/11 12:19:18 UTC

[GitHub] [calcite] vlsi opened a new pull request #1749: Refine rules to avoid producing matches that are known to be no-op

vlsi opened a new pull request #1749: Refine rules to avoid producing matches that are known to be no-op
URL: https://github.com/apache/calcite/pull/1749
 
 
   UnionMergeRule produced lots of unrelated matches because it
   mathed only the top operand as SetOp.
   Bottom operand classes were compared in onMatch method only, so
   it resulted in lots of false positives for the optimizer.
   
   Not it does not get added to the optimizer queue at all.

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


With regards,
Apache Git Services

[GitHub] [calcite] jinxing64 commented on a change in pull request #1749: Refine rules to avoid producing matches that are known to be no-op

Posted by GitBox <gi...@apache.org>.
jinxing64 commented on a change in pull request #1749: Refine rules to avoid producing matches that are known to be no-op
URL: https://github.com/apache/calcite/pull/1749#discussion_r365591605
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java
 ##########
 @@ -43,7 +43,9 @@
    */
   public UnionToDistinctRule(Class<? extends Union> unionClazz,
       RelBuilderFactory relBuilderFactory) {
-    super(operand(unionClazz, any()), relBuilderFactory, null);
+    super(
+        operandJ(unionClazz, null, union -> !union.all, any()),
+        relBuilderFactory, null);
 
 Review comment:
   Hi @vlsi 
   Shall we do analogous optimization for rules like `ProjectSetOpTransposeRule`, `AggregateUnionAggregateRule`, `AggregateUnionTransposeRule`. I mean check `setOp.all` or `union.all` by `operandJ`, rather than checking in method of `onMatch`, thus to save the "match" to be added into optimizer queue 

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


With regards,
Apache Git Services

[GitHub] [calcite] vlsi commented on a change in pull request #1749: Refine rules to avoid producing matches that are known to be no-op

Posted by GitBox <gi...@apache.org>.
vlsi commented on a change in pull request #1749: Refine rules to avoid producing matches that are known to be no-op
URL: https://github.com/apache/calcite/pull/1749#discussion_r365594891
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java
 ##########
 @@ -43,7 +43,9 @@
    */
   public UnionToDistinctRule(Class<? extends Union> unionClazz,
       RelBuilderFactory relBuilderFactory) {
-    super(operand(unionClazz, any()), relBuilderFactory, null);
+    super(
+        operandJ(unionClazz, null, union -> !union.all, any()),
+        relBuilderFactory, null);
 
 Review comment:
   That is true: it is better to use `operandJ` or `matches` methods to reduce the planning overhead.
   
   I improved the rules that produced lots of false positives in MaterializedTest, and I have not verified other rules.
   

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


With regards,
Apache Git Services

[GitHub] [calcite] vlsi merged pull request #1749: Refine rules to avoid producing matches that are known to be no-op

Posted by GitBox <gi...@apache.org>.
vlsi merged pull request #1749: Refine rules to avoid producing matches that are known to be no-op
URL: https://github.com/apache/calcite/pull/1749
 
 
   

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


With regards,
Apache Git Services