drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudheeshkatkam <...@git.apache.org>
Subject [GitHub] drill pull request #555: DRILL-4147: Change union-all distribution trait to ...
Date Mon, 01 Aug 2016 17:55:55 GMT
Github user sudheeshkatkam commented on a diff in the pull request:

    https://github.com/apache/drill/pull/555#discussion_r73022613
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java ---
    @@ -1013,4 +1019,97 @@ public void testUnionAllInWith() throws Exception {
             .build()
             .run();
       }
    +
    +  @Test // DRILL-4147 // base case
    +  public void testDrill4147_1() throws Exception {
    +    final String l = FileUtils.getResourceAsFile("/multilevel/parquet/1994").toURI().toString();
    +    final String r = FileUtils.getResourceAsFile("/multilevel/parquet/1995").toURI().toString();
    +
    +    final String query = String.format("SELECT o_custkey FROM dfs_test.`%s` \n" +
    +        "Union All SELECT o_custkey FROM dfs_test.`%s`", l, r);
    +
    +    // Validate the plan
    +    final String[] expectedPlan = {"UnionExchange.*\n",
    +        ".*Project.*\n" +
    +        ".*UnionAll"};
    +    final String[] excludedPlan = {};
    +
    +    test(sliceTargetSmall);
    +    PlanTestBase.testPlanMatchingPatterns(query, expectedPlan, excludedPlan);
    +
    +    try {
    +      testBuilder()
    +        .optionSettingQueriesForTestQuery(sliceTargetSmall)
    +        .optionSettingQueriesForBaseline(sliceTargetDefault)
    +        .unOrdered()
    +        .sqlQuery(query)
    +        .sqlBaselineQuery(query)
    +        .build()
    +        .run();
    +    } finally {
    +      test(sliceTargetDefault);
    +    }
    +  }
    +
    +  @Test // DRILL-4147  // group-by on top of union-all
    +  public void testDrill4147_2() throws Exception {
    +    final String l = FileUtils.getResourceAsFile("/multilevel/parquet/1994").toURI().toString();
    +    final String r = FileUtils.getResourceAsFile("/multilevel/parquet/1995").toURI().toString();
    +
    +    final String query = String.format("Select o_custkey, count(*) as cnt from \n" +
    +        " (SELECT o_custkey FROM dfs_test.`%s` \n" +
    +        "Union All SELECT o_custkey FROM dfs_test.`%s`) \n" +
    +        "group by o_custkey", l, r);
    +
    +    // Validate the plan
    +    final String[] expectedPlan = {"(?s)UnionExchange.*HashAgg.*HashToRandomExchange.*UnionAll.*"};
    +    final String[] excludedPlan = {};
    +
    +    test(sliceTargetSmall);
    +    PlanTestBase.testPlanMatchingPatterns(query, expectedPlan, excludedPlan);
    +
    +    try {
    +      testBuilder()
    +        .optionSettingQueriesForTestQuery(sliceTargetSmall)
    +        .optionSettingQueriesForBaseline(sliceTargetDefault)
    +        .unOrdered()
    +        .sqlQuery(query)
    +        .sqlBaselineQuery(query)
    +        .build()
    +        .run();
    +    } finally {
    +      test(sliceTargetDefault);
    +    }
    +  }
    +
    +  @Test // DRILL-4147 // union-all above a hash join
    +  public void testDrill4147_3() throws Exception {
    +    final String l = FileUtils.getResourceAsFile("/multilevel/parquet/1994").toURI().toString();
    +    final String r = FileUtils.getResourceAsFile("/multilevel/parquet/1995").toURI().toString();
    +
    +    final String query = String.format("SELECT o_custkey FROM \n" +
    +        " (select o1.o_custkey from dfs_test.`%s` o1 inner join dfs_test.`%s` o2 on o1.o_orderkey
= o2.o_custkey) \n" +
    +        " Union All SELECT o_custkey FROM dfs_test.`%s` where o_custkey < 10", l,
r, l);
    +
    +    // Validate the plan
    +    final String[] expectedPlan = {"(?s)UnionExchange.*UnionAll.*HashJoin.*"};
    +    final String[] excludedPlan = {};
    +
    +    test(sliceTargetSmall);
    --- End diff --
    
    These two calls should be inside the try block?


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

Mime
View raw message