You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@quickstep.apache.org by zuyu <gi...@git.apache.org> on 2017/07/09 22:53:51 UTC

[GitHub] incubator-quickstep pull request #268: Skip predicate pushdown if the node's...

GitHub user zuyu opened a pull request:

    https://github.com/apache/incubator-quickstep/pull/268

    Skip predicate pushdown if the node's input is a base relation.

    Assigned to @jianqiao.
    
    This small PR fixed the bug in PR #174 that we may have two identical `Selection`s due to the predicate pushdown. The fix avoids such case by skipping the pushdown if and only if a node's input is a base table.
    
    For the following test query in `Partition.test`:
    
    ```
    SELECT fact.id, test.char_col
    FROM test JOIN fact ON test.int_col = fact.id
    WHERE test.int_col > 0 OR test.int_col < 0;
    ```
    
    Previously to this PR, we would generate a bad plan with two same `Selection`s.
    ```
    9: I0708 15:31:29.931959 3661849536 PhysicalGenerator.cpp:192] After applying rule PruneColumns:
    9: TopLevelPlan
    9: +-plan=HashJoin
    9: | +-left=Selection
    9: | | +-input=TableReference[relation=Test,alias=test]
    9: | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
    9: | | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
    9: | | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
    9: | | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | | +-filter_predicate=Or
    9: | | | +-Greater
    9: | | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | | +-Literal[value=0,type=Int]
    9: | | | +-Less
    9: | | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | |   +-Literal[value=0,type=Int]
    9: | | +-project_expressions=
    9: | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | |   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | +-right=TableReference[relation=fact,
    9: | | output_partition_scheme_header=PARTITION BY HASH ( { 5 } ) PARTITIONS 4]
    9: | | +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: | | +-AttributeReference[id=6,name=score,relation=fact,type=Double NULL]
    9: | +-project_expressions=
    9: | | +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | +-left_join_attributes=
    9: | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | +-right_join_attributes=
    9: |   +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: +-output_attributes=
    9:   +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9:   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: I0708 15:31:29.932862 3661849536 PhysicalGenerator.cpp:192] After applying rule PushDownLowCostDisjunctivePredicate:
    9: TopLevelPlan
    9: +-plan=HashJoin
    9: | +-left=Selection
    9: | | +-input=Selection
    9: | | | +-input=TableReference[relation=Test,alias=test]
    9: | | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
    9: | | | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
    9: | | | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
    9: | | | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | | | +-filter_predicate=Or
    9: | | | | +-Greater
    9: | | | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | | | +-Literal[value=0,type=Int]
    9: | | | | +-Less
    9: | | | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | |   +-Literal[value=0,type=Int]
    9: | | | +-project_expressions=
    9: | | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | |   +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
    9: | | |   +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
    9: | | |   +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
    9: | | |   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | | +-filter_predicate=Or
    9: | | | +-Greater
    9: | | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | | | +-Literal[value=0,type=Int]
    9: | | | +-Less
    9: | | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | | |   +-Literal[value=0,type=Int]
    9: | | +-project_expressions=
    9: | |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | |   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | +-right=TableReference[relation=fact,
    9: | | output_partition_scheme_header=PARTITION BY HASH ( { 5 } ) PARTITIONS 4]
    9: | | +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: | | +-AttributeReference[id=6,name=score,relation=fact,type=Double NULL]
    9: | +-project_expressions=
    9: | | +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    9: | +-left_join_attributes=
    9: | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
    9: | +-right_join_attributes=
    9: |   +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9: +-output_attributes=
    9:   +-AttributeReference[id=5,name=id,relation=fact,type=Int NULL]
    9:   +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zuyu/incubator-quickstep skip-predicate-pushdown

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quickstep/pull/268.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #268
    
----
commit 7a1d827fb584074840ae9523fb910295af6f9c25
Author: Zuyu Zhang <zu...@cs.wisc.edu>
Date:   2017-07-09T22:44:19Z

    Skip predicate pushdown if the node's input is a base relation.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep issue #268: Skip predicate pushdown if the node's input ...

Posted by jianqiao <gi...@git.apache.org>.
Github user jianqiao commented on the issue:

    https://github.com/apache/incubator-quickstep/pull/268
  
    LGTM! Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quickstep pull request #268: Skip predicate pushdown if the node's...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-quickstep/pull/268


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---