You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiatao Tao (Jira)" <ji...@apache.org> on 2020/12/04 04:28:00 UTC

[jira] [Comment Edited] (CALCITE-4426) Improve the performance of RelSubset#getRelList

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

Jiatao Tao edited comment on CALCITE-4426 at 12/4/20, 4:27 AM:
---------------------------------------------------------------

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

Before the patch: 39s;

After the patch: 34s;

Without pull/2222: 30s;
{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}
 


was (Author: aron.tao):
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
>




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