You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by vdiravka <gi...@git.apache.org> on 2018/04/17 20:43:52 UTC

[GitHub] drill pull request #1216: DRILL-6173: Support transitive closure during filt...

GitHub user vdiravka opened a pull request:

    https://github.com/apache/drill/pull/1216

    DRILL-6173: Support transitive closure during filter push down and pa…

    …rtition pruning

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

    $ git pull https://github.com/vdiravka/drill DRILL-6173

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

    https://github.com/apache/drill/pull/1216.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 #1216
    
----
commit ad673cd8030ce1540a1c5bb5a55f6a2c8dbcb5d3
Author: Vitalii Diravka <vi...@...>
Date:   2018-04-17T11:38:03Z

    DRILL-6173: Support transitive closure during filter push down and partition pruning

----


---

[GitHub] drill issue #1216: DRILL-6173: Support transitive closure during filter push...

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

    https://github.com/apache/drill/pull/1216
  
    +1


---

[GitHub] drill issue #1216: DRILL-6173: Support transitive closure during filter push...

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

    https://github.com/apache/drill/pull/1216
  
    @vvysotskyi / @amansinha100 please review.


---

[GitHub] drill pull request #1216: DRILL-6173: Support transitive closure during filt...

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

    https://github.com/apache/drill/pull/1216


---

[GitHub] drill pull request #1216: DRILL-6173: Support transitive closure during filt...

Posted by amansinha100 <gi...@git.apache.org>.
Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1216#discussion_r183097212
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/TestTransitiveClosure.java ---
    @@ -0,0 +1,102 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.planner.logical;
    +
    +import org.apache.drill.PlanTestBase;
    +import org.apache.drill.categories.PlannerTest;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +import org.junit.experimental.categories.Category;
    +
    +import java.nio.file.Paths;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +@Category(PlannerTest.class)
    +public class TestTransitiveClosure extends PlanTestBase {
    +
    +  @BeforeClass
    +  public static void setupTestFiles() {
    +    dirTestWatcher.copyResourceToRoot(Paths.get("join"));
    +  }
    +
    +
    +  @Test // CALCITE-2200: (query with infinite loop)
    +  public void simpleInfiniteLoop() throws Exception {
    +    String query = "SELECT t1.department_id FROM cp.`employee.json` t1 " +
    +        " WHERE t1.department_id IN (SELECT department_id FROM cp.`department.json` t2 " +
    +        "                            WHERE t1.department_id = t2.department_id " +
    +        "                            OR (t1.department_id IS NULL and t2.department_id IS NULL))";
    +    int actualRowCount = testSql(query);
    +    int expectedRowCount = 1155;
    +    assertEquals("Expected and actual row count should match", expectedRowCount, actualRowCount);
    +
    +    // TODO: After resolving CALCITE-2257 there will not be Filter with OR(IS NOT NULL($0), IS NULL($0)) condition
    +    // Then remove testPlanMatchingPatterns() from this test
    +    final String[] expectedPlan =
    +        new String[] {"Filter\\(condition=\\[OR\\(IS NOT NULL\\(\\$0\\), IS NULL\\(\\$0\\)\\)\\]\\)"};
    +    final String[] excludedPlan ={};
    +    testPlanMatchingPatterns(query, expectedPlan, excludedPlan);
    +  }
    +
    +  @Test // CALCITE-2205 (query with infinite loop)
    +  public void infiniteLoopWhilePlaningComplexQuery() throws Exception {
    --- End diff --
    
    For complex queries such as this I would suggest to move them out of unit tests, into functional test suite. 


---

[GitHub] drill pull request #1216: DRILL-6173: Support transitive closure during filt...

Posted by vdiravka <gi...@git.apache.org>.
Github user vdiravka commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1216#discussion_r183329162
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/TestTransitiveClosure.java ---
    @@ -0,0 +1,102 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.exec.planner.logical;
    +
    +import org.apache.drill.PlanTestBase;
    +import org.apache.drill.categories.PlannerTest;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +import org.junit.experimental.categories.Category;
    +
    +import java.nio.file.Paths;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +@Category(PlannerTest.class)
    +public class TestTransitiveClosure extends PlanTestBase {
    +
    +  @BeforeClass
    +  public static void setupTestFiles() {
    +    dirTestWatcher.copyResourceToRoot(Paths.get("join"));
    +  }
    +
    +
    +  @Test // CALCITE-2200: (query with infinite loop)
    +  public void simpleInfiniteLoop() throws Exception {
    +    String query = "SELECT t1.department_id FROM cp.`employee.json` t1 " +
    +        " WHERE t1.department_id IN (SELECT department_id FROM cp.`department.json` t2 " +
    +        "                            WHERE t1.department_id = t2.department_id " +
    +        "                            OR (t1.department_id IS NULL and t2.department_id IS NULL))";
    +    int actualRowCount = testSql(query);
    +    int expectedRowCount = 1155;
    +    assertEquals("Expected and actual row count should match", expectedRowCount, actualRowCount);
    +
    +    // TODO: After resolving CALCITE-2257 there will not be Filter with OR(IS NOT NULL($0), IS NULL($0)) condition
    +    // Then remove testPlanMatchingPatterns() from this test
    +    final String[] expectedPlan =
    +        new String[] {"Filter\\(condition=\\[OR\\(IS NOT NULL\\(\\$0\\), IS NULL\\(\\$0\\)\\)\\]\\)"};
    +    final String[] excludedPlan ={};
    +    testPlanMatchingPatterns(query, expectedPlan, excludedPlan);
    +  }
    +
    +  @Test // CALCITE-2205 (query with infinite loop)
    +  public void infiniteLoopWhilePlaningComplexQuery() throws Exception {
    --- End diff --
    
    This test and other one from TestTransitiveClosure.java are from functional test suite.
    So we can remove them from unit tests scope.


---