Github user amansinha100 commented on a diff in the pull request:
https://github.com/apache/drill/pull/559#discussion_r73649304
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/TestPartitionFilter.java ---
@@ -386,4 +386,49 @@ public void testPartitionFilterWithInSubquery() throws
Exception {
test("alter session set `planner.in_subquery_threshold` = 10");
testExcludeFilter(query, 4, "Filter", 40);
}
+
+
+ @Test // DRILL-4825: querying same table with different filter in UNION
ALL.
+ public void testPruneSameTableInUnionAll() throws Exception {
+ final String query = String.format("select count(*) as cnt from "
+ + "( select dir0 from dfs_test.`%s/multilevel/parquet` where dir0
in ('1994') union all "
+ + " select dir0 from dfs_test.`%s/multilevel/parquet` where dir0
in ('1995', '1996') )",
+ TEST_RES_PATH, TEST_RES_PATH);
+
+ String [] exclued = {"Filter"};
+
+ // verify plan that filter is applied in partition pruning.
+ testPlanMatchingPatterns(query, null, exclued);
+
+ // verify we get correct count(*).
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("cnt")
+ .baselineValues((long)120)
+ .build()
+ .run();
+ }
+
+ @Test // DRILL-4825: querying same table with different filter in Join.
+ public void testPruneSameTableInJoin() throws Exception {
+ final String query = String.format("select * from "
+ + "( select sum(o_custkey) as x from
dfs_test.`%s/multilevel/parquet` where dir0 in ('1994') ) join "
+ + " ( select sum(o_custkey) as y from
dfs_test.`%s/multilevel/parquet` where dir0 in ('1995', '1996')) "
+ + " on x = y ",
+ TEST_RES_PATH, TEST_RES_PATH);
+
+ String [] exclued = {"Filter"};
--- End diff --
same as above
---
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.
---