Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D879A200B51 for ; Mon, 1 Aug 2016 19:55:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D70A9160A6C; Mon, 1 Aug 2016 17:55:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2B6DC160A66 for ; Mon, 1 Aug 2016 19:55:57 +0200 (CEST) Received: (qmail 13351 invoked by uid 500); 1 Aug 2016 17:55:56 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 13340 invoked by uid 99); 1 Aug 2016 17:55:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Aug 2016 17:55:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C843EE058E; Mon, 1 Aug 2016 17:55:55 +0000 (UTC) From: sudheeshkatkam To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #555: DRILL-4147: Change union-all distribution trait to ... Content-Type: text/plain Message-Id: <20160801175555.C843EE058E@git1-us-west.apache.org> Date: Mon, 1 Aug 2016 17:55:55 +0000 (UTC) archived-at: Mon, 01 Aug 2016 17:55:58 -0000 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. ---