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

ASF GitHub Bot commented on DRILL-6173:
---------------------------------------

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. 


> Support transitive closure during filter push down and partition pruning
> ------------------------------------------------------------------------
>
>                 Key: DRILL-6173
>                 URL: https://issues.apache.org/jira/browse/DRILL-6173
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Query Planning & Optimization
>    Affects Versions: 1.12.0
>            Reporter: Vitalii Diravka
>            Assignee: Vitalii Diravka
>            Priority: Major
>              Labels: doc-impacting
>             Fix For: 1.14.0
>
>
> There is Calcite rule JoinPushTransitivePredicatesRule but it does not work 
> in Drill. 
> Applying it in Drill will allow for equi-join queries to push filter 
> condition from one table to another:
> {code:sql}
> select * 
> from A, B 
> where
> A.id = B.id and 
> B.id = 100
> {code}
> In that case it is possible that Scan operator for A table will not scan all 
> data. 
> For table A it can lead for applying: 
> 1. [Partition pruning for Hive or file system Parquet 
> tables|https://drill.apache.org/docs/partition-pruning-introduction/] 
> 2. [Parquet filter 
> pushdown|https://drill.apache.org/docs/parquet-filter-pushdown/]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to