Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/555#discussion_r73054394
  
    --- 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);
    --- End diff --
    
    Yes, I will move this and other such calls within the try block.  Thanks 
for pointing out. 


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to