[ 
https://issues.apache.org/jira/browse/CALCITE-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17243680#comment-17243680
 ] 

Jiatao Tao commented on CALCITE-4426:
-------------------------------------

Hi [~julianhyde], sorry about that.

RelSubset#getRelList has some overhead, 
[https://github.com/apache/calcite/pull/2222] ,brought TpchTest#testQuery07 
about 25 overhead. And in 
[https://github.com/apache/calcite/pull/2283,|https://github.com/apache/calcite/pull/2283]
 we can see OOM in VolcanoRuleCall.matchRecurse when calling getRelList, so 
this Jira aim to improve the performance of RelSubset#getRelList.



Julian made a proposal that can improve the RelSubset#getRelList, we may merge 
that to the mater first.
{code:java}
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
b/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
index b1e0b6322..7f7e8cbc9 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java
@@ -399,7 +399,7 @@ RelNode buildCheapestPlan(VolcanoPlanner planner) {
   public List<RelNode> getRelList() {
     final List<RelNode> list = new ArrayList<>();
     for (RelNode rel : set.rels) {
-      if (rel.getTraitSet().satisfies(traitSet)) {
+      if (rel.getTraitSet() == traitSet ||
rel.getTraitSet().satisfies(traitSet)) {
         list.add(rel);
       }
     }
{code}
 

> Improve the performance of RelSubset#getRelList
> -----------------------------------------------
>
>                 Key: CALCITE-4426
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4426
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jiatao Tao
>            Assignee: Jiatao Tao
>            Priority: Major
>         Attachments: image-2020-12-04-11-44-18-632.png
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to