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

    https://github.com/apache/drill/pull/169#discussion_r40445053
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestLimitWithExchanges.java
 ---
    @@ -26,4 +30,34 @@
       public void testLimitWithExchanges() throws Exception{
         testPhysicalFromFile("limit/limit_exchanges.json");
       }
    +
    +  @Test
    +  public void testPushLimitPastUnionExchange() throws Exception {
    +    // Push limit past through UnionExchange.
    +    final String WORKING_PATH = TestTools.getWorkingPath();
    +    final String TEST_RES_PATH = WORKING_PATH + "/src/test/resources";
    +
    +    try {
    +      // case 1. single table query.
    +      final String sql = String.format("select * from 
dfs_test.`%s/tpchmulti/region` limit 1 offset 2", TEST_RES_PATH);
    +      test("alter session set `planner.slice_target` = 1");
    +      // test(sql);
    +
    +      // Validate the plan
    +      final String[] expectedPlan = 
{"(?s)Limit.*UnionExchange.*Limit.*Scan"};
    +      final String[] excludedPatterns = {};
    +      PlanTestBase.testPlanMatchingPatterns(sql, expectedPlan, 
excludedPatterns);
    +
    +      // case 2: join query.
    +      final String sql2 = String.format("select * from 
dfs_test.`%s/tpchmulti/region` r,  dfs_test.`%s/tpchmulti/nation` n where 
r.r_regionkey = n.n_regionkey limit 1 offset 2", TEST_RES_PATH, TEST_RES_PATH );
    +      // Validate the plan
    +      final String[] expectedPlan2 = 
{"(?s)Limit.*UnionExchange.*Limit.*Join"};
    +      final String[] excludedPatterns2 = {};
    +      PlanTestBase.testPlanMatchingPatterns(sql2, expectedPlan2, 
excludedPatterns2);
    +    } finally {
    +      test("alter session set `planner.slice_target` = " + 
ExecConstants.SLICE_TARGET_OPTION.getDefault().getValue());
    +    }
    +    // test(sql2);
    --- End diff --
    
    Remove extraneous lines..


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to