Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-1275

Optimizer pushs down non-equi filter as theta join qualifier

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None

      Description

      Plan rewriter pushes down filters to leaf node as possible and changes filter condition to join qualifier if possible.

      Even though Tajo does not support theta-join completely, however,
      it pushes down non-equi compare and makes it as join qualifier sometimes.

      For example,

      select * from (select a.r_name as a_name, b.c_name as c_name from region a, customer b) xx where a_name < c_name
      

      is rewritten as

      select a.r_name as a_name, b.c_name as c_name from region a join customer b on a.r_name < b.c_name
      

      And

      select * from region a join customer b on a.r_regionkey = b.c_custkey where a.r_name < c.c_name
      

      is rewritten as

      select * from region a join customer b on a.r_regionkey = b.c_custkey and a.r_name < c.c_name
      

      Until TAJO-742 is resolved (that means theta join is supported),
      I think it should not be allowed to rewrite non-equi filter condition as join qualifier.

        Activity

        Hide
        sirpkt Keuntae Park added a comment -

        As got +1, I committed the patch.
        Thank you for the review, Jihoon Son.

        Show
        sirpkt Keuntae Park added a comment - As got +1, I committed the patch. Thank you for the review, Jihoon Son .
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #529 (See https://builds.apache.org/job/Tajo-master-build/529/)
        TAJO-1275: Optimizer pushs down non-equi filter as theta join qualifier (sirpkt: rev 9e329a5509b71fa412299169dd3c866e54f46c77)

        • tajo-core/src/test/resources/results/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/resources/results/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.result
        • CHANGES
        • tajo-core/src/test/resources/queries/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/resources/queries/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
        • tajo-core/src/test/resources/queries/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/resources/queries/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.sql
        • tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
        • tajo-core/src/test/resources/results/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/resources/results/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #529 (See https://builds.apache.org/job/Tajo-master-build/529/ ) TAJO-1275 : Optimizer pushs down non-equi filter as theta join qualifier (sirpkt: rev 9e329a5509b71fa412299169dd3c866e54f46c77) tajo-core/src/test/resources/results/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/resources/results/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.result CHANGES tajo-core/src/test/resources/queries/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/resources/queries/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java tajo-core/src/test/resources/queries/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/resources/queries/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.sql tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java tajo-core/src/test/resources/results/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/resources/results/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #168 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/168/)
        TAJO-1275: Optimizer pushs down non-equi filter as theta join qualifier (sirpkt: rev 9e329a5509b71fa412299169dd3c866e54f46c77)

        • CHANGES
        • tajo-core/src/test/resources/results/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/resources/queries/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
        • tajo-core/src/test/resources/queries/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/resources/results/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        • tajo-core/src/test/resources/queries/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.sql
        • tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
        • tajo-core/src/test/resources/results/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.result
        • tajo-core/src/test/resources/queries/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.sql
        • tajo-core/src/test/resources/results/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.result
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #168 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/168/ ) TAJO-1275 : Optimizer pushs down non-equi filter as theta join qualifier (sirpkt: rev 9e329a5509b71fa412299169dd3c866e54f46c77) CHANGES tajo-core/src/test/resources/results/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/resources/queries/TestJoinQuery/testCrossJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java tajo-core/src/test/resources/queries/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/resources/results/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java tajo-core/src/test/resources/queries/TestJoinQuery/testInnerJoinWithThetaJoinConditionInWhere.sql tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java tajo-core/src/test/resources/results/TestJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.result tajo-core/src/test/resources/queries/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.sql tajo-core/src/test/resources/results/TestJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.result
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user sirpkt commented on the pull request:

        https://github.com/apache/tajo/pull/327#issuecomment-68577555

        Thank you for the review, @jihoonson.
        I added the comments about TODO and just committed the patch.

        Show
        githubbot ASF GitHub Bot added a comment - Github user sirpkt commented on the pull request: https://github.com/apache/tajo/pull/327#issuecomment-68577555 Thank you for the review, @jihoonson. I added the comments about TODO and just committed the patch.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/327

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/327
        Hide
        sirpkt Keuntae Park added a comment -

        I made pull request but name was slightly different from issues name (now, fixed).
        Following is github message:

        GitHub user sirpkt opened a pull request:

        https://github.com/apache/tajo/pull/327

        Tajo-1275: Optimizer pushs down non-equi filter as theta join qualifier

        This patch prevents non-equi filter condition becomes join qualifier of child nodes.
        It can avoid theta join is created as a result of filter push down.

        in FilterPushDownRule.java, visitJoin() additionally checks all the join qualifier candidates from pushing down filters whether it is non-equi join qualifier or not.

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

        $ git pull https://github.com/sirpkt/tajo TAJO-1275

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

        https://github.com/apache/tajo/pull/327.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 #327


        commit 8915b4b598fcb82ceba7ec722b1a422b8ad29f55
        Author: sirpkt <sirpkt@apache.org>
        Date: 2014-12-31T08:22:52Z

        Filter push down is changed not to push down theta join condition

        commit 376bd194c51a23d407cc0161b7c9c9dae6f36714
        Author: sirpkt <sirpkt@apache.org>
        Date: 2015-01-02T02:07:38Z

        add test cases for inner, left outer, right outer joins


        Show
        sirpkt Keuntae Park added a comment - I made pull request but name was slightly different from issues name (now, fixed). Following is github message: GitHub user sirpkt opened a pull request: https://github.com/apache/tajo/pull/327 Tajo-1275: Optimizer pushs down non-equi filter as theta join qualifier This patch prevents non-equi filter condition becomes join qualifier of child nodes. It can avoid theta join is created as a result of filter push down. in FilterPushDownRule.java, visitJoin() additionally checks all the join qualifier candidates from pushing down filters whether it is non-equi join qualifier or not. You can merge this pull request into a Git repository by running: $ git pull https://github.com/sirpkt/tajo TAJO-1275 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/327.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 #327 commit 8915b4b598fcb82ceba7ec722b1a422b8ad29f55 Author: sirpkt <sirpkt@apache.org> Date: 2014-12-31T08:22:52Z Filter push down is changed not to push down theta join condition commit 376bd194c51a23d407cc0161b7c9c9dae6f36714 Author: sirpkt <sirpkt@apache.org> Date: 2015-01-02T02:07:38Z add test cases for inner, left outer, right outer joins

          People

          • Assignee:
            sirpkt Keuntae Park
            Reporter:
            sirpkt Keuntae Park
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development