You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by jn...@apache.org on 2015/06/12 23:20:48 UTC
drill git commit: DRILL-1169: Add Calcite's UnionToDistinctRule to
DrillRuleSets to implement Union-Distinct
Repository: drill
Updated Branches:
refs/heads/master fb1d3f384 -> 45a82c457
DRILL-1169: Add Calcite's UnionToDistinctRule to DrillRuleSets to implement Union-Distinct
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/45a82c45
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/45a82c45
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/45a82c45
Branch: refs/heads/master
Commit: 45a82c4577b0c582202e02f5401a559b669dc992
Parents: fb1d3f3
Author: Hsuan-Yi Chu <hs...@usc.edu>
Authored: Wed Jun 3 16:55:42 2015 -0700
Committer: Jinfeng Ni <jn...@apache.org>
Committed: Fri Jun 12 14:19:03 2015 -0700
----------------------------------------------------------------------
.../exec/planner/logical/DrillRuleSets.java | 8 +-
.../exec/planner/logical/DrillUnionAllRule.java | 67 ++
.../exec/planner/logical/DrillUnionRel.java | 2 +
.../exec/planner/logical/DrillUnionRule.java | 61 --
.../sql/parser/UnsupportedOperatorsVisitor.java | 11 -
.../apache/drill/TestDisabledFunctionality.java | 18 -
.../org/apache/drill/TestUnionDistinct.java | 683 +++++++++++++++++++
.../TestUnionDistinctQueries/q1.tsv | 5 +
.../TestUnionDistinctQueries/q10.tsv | 30 +
.../TestUnionDistinctQueries/q11.tsv | 30 +
.../TestUnionDistinctQueries/q12.tsv | 30 +
.../TestUnionDistinctQueries/q13.tsv | 20 +
.../TestUnionDistinctQueries/q14.tsv | 30 +
.../TestUnionDistinctQueries/q15.tsv | 8 +
.../TestUnionDistinctQueries/q16.tsv | 3 +
.../TestUnionDistinctQueries/q17.tsv | 5 +
.../TestUnionDistinctQueries/q18_1.tsv | 4 +
.../TestUnionDistinctQueries/q18_2.tsv | 13 +
.../TestUnionDistinctQueries/q18_3.tsv | 13 +
.../TestUnionDistinctQueries/q2.tsv | 4 +
.../TestUnionDistinctQueries/q3.tsv | 5 +
.../TestUnionDistinctQueries/q4.tsv | 25 +
.../TestUnionDistinctQueries/q5.tsv | 5 +
.../TestUnionDistinctQueries/q6.tsv | 6 +
.../TestUnionDistinctQueries/q6_1.tsv | 25 +
.../TestUnionDistinctQueries/q7.tsv | 2 +
.../TestUnionDistinctQueries/q8.tsv | 30 +
.../TestUnionDistinctQueries/q9.tsv | 20 +
...testAggregationOnUnionDistinctOperator_1.tsv | 4 +
...testAggregationOnUnionDistinctOperator_2.tsv | 4 +
...jectDownOverUnionDistinctImplicitCasting.tsv | 10 +
...tProjectFiltertPushDownOverUnionDistinct.tsv | 6 +
...jectPushDownOverUnionDistinctWithProject.tsv | 30 +
...tPushDownOverUnionDistinctWithoutProject.tsv | 30 +
...tPushDownProjectColumnReorderingAndAlias.tsv | 30 +
...tWithExpressionPushDownOverUnionDistinct.tsv | 30 +
36 files changed, 1214 insertions(+), 93 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java
index 655ad92..d9b1354 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java
@@ -28,6 +28,7 @@ import org.apache.calcite.rel.rules.JoinPushThroughJoinRule;
import org.apache.calcite.rel.rules.ProjectRemoveRule;
import org.apache.calcite.rel.rules.ReduceExpressionsRule;
import org.apache.calcite.rel.rules.SortRemoveRule;
+import org.apache.calcite.rel.rules.UnionToDistinctRule;
import org.apache.calcite.tools.RuleSet;
import org.apache.calcite.rel.rules.FilterMergeRule;
@@ -121,6 +122,9 @@ public class DrillRuleSets {
if (DRILL_BASIC_RULES == null) {
DRILL_BASIC_RULES = new DrillRuleSet(ImmutableSet.<RelOptRule> builder().add( //
+ // Add support for Distinct Union (by using Union-All followed by Distinct)
+ UnionToDistinctRule.INSTANCE,
+
// Add support for WHERE style joins.
DrillFilterJoinRules.DRILL_FILTER_ON_JOIN,
DrillFilterJoinRules.DRILL_JOIN,
@@ -165,7 +169,7 @@ public class DrillRuleSets {
DrillLimitRule.INSTANCE,
DrillSortRule.INSTANCE,
DrillJoinRule.INSTANCE,
- DrillUnionRule.INSTANCE,
+ DrillUnionAllRule.INSTANCE,
DrillValuesRule.INSTANCE
)
.build());
@@ -208,8 +212,6 @@ public class DrillRuleSets {
ruleList.add(UnionAllPrule.INSTANCE);
ruleList.add(ValuesPrule.INSTANCE);
- // ruleList.add(UnionDistinctPrule.INSTANCE);
-
if (ps.isHashAggEnabled()) {
ruleList.add(HashAggPrule.INSTANCE);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionAllRule.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionAllRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionAllRule.java
new file mode 100644
index 0000000..10c0118
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionAllRule.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.planner.logical;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.drill.exec.planner.common.DrillUnionRelBase;
+import org.apache.calcite.rel.InvalidRelException;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.logical.LogicalUnion;
+import org.apache.calcite.plan.Convention;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.util.trace.CalciteTrace;
+
+/**
+ * Rule that converts a {@link LogicalUnion} to a {@link DrillUnionRelBase}, implemented by a "union" operation.
+ */
+public class DrillUnionAllRule extends RelOptRule {
+ public static final RelOptRule INSTANCE = new DrillUnionAllRule();
+ protected static final Logger tracer = CalciteTrace.getPlannerTracer();
+
+ private DrillUnionAllRule() {
+ super(RelOptHelper.any(LogicalUnion.class, Convention.NONE), "DrillUnionRule");
+ }
+
+ @Override
+ public void onMatch(RelOptRuleCall call) {
+ final LogicalUnion union = (LogicalUnion) call.rel(0);
+
+ // This rule applies to Union-All only
+ if(!union.all) {
+ return;
+ }
+
+ final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
+ final List<RelNode> convertedInputs = new ArrayList<>();
+ for (RelNode input : union.getInputs()) {
+ final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
+ convertedInputs.add(convertedInput);
+ }
+ try {
+ call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
+ true /* check compatibility */));
+ } catch (InvalidRelException e) {
+ tracer.warning(e.toString()) ;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java
index 566c558..905b3df 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java
@@ -24,6 +24,8 @@ import org.apache.calcite.linq4j.Ord;
import org.apache.drill.common.logical.data.LogicalOperator;
import org.apache.drill.common.logical.data.Union;
import org.apache.drill.exec.planner.common.DrillUnionRelBase;
+import org.apache.drill.exec.planner.cost.DrillCostBase;
+import org.apache.drill.exec.planner.cost.DrillRelOptCostFactory;
import org.apache.drill.exec.planner.torel.ConversionContext;
import org.apache.calcite.rel.InvalidRelException;
import org.apache.calcite.rel.RelNode;
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java
deleted file mode 100644
index e0f9e2d..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.planner.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.drill.exec.planner.common.DrillUnionRelBase;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.logical.LogicalUnion;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.util.trace.CalciteTrace;
-
-/**
- * Rule that converts a {@link LogicalUnion} to a {@link DrillUnionRelBase}, implemented by a "union" operation.
- */
-public class DrillUnionRule extends RelOptRule {
- public static final RelOptRule INSTANCE = new DrillUnionRule();
- protected static final Logger tracer = CalciteTrace.getPlannerTracer();
-
- private DrillUnionRule() {
- super(RelOptHelper.any(LogicalUnion.class, Convention.NONE), "DrillUnionRule");
- }
-
- @Override
- public void onMatch(RelOptRuleCall call) {
- final LogicalUnion union = (LogicalUnion) call.rel(0);
- final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
- final List<RelNode> convertedInputs = new ArrayList<>();
- for (RelNode input : union.getInputs()) {
- final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
- convertedInputs.add(convertedInput);
- }
- try {
- call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
- true /* check compatibility */));
- } catch (InvalidRelException e) {
- tracer.warning(e.toString()) ;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
index b92de3b..f3c54cc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
@@ -138,17 +138,6 @@ public class UnsupportedOperatorsVisitor extends SqlShuttle {
throw new UnsupportedOperationException();
}
- // Disable unsupported Union
- if(sqlCall.getKind() == SqlKind.UNION) {
- SqlSetOperator op = (SqlSetOperator) sqlCall.getOperator();
- if(!op.isAll()) {
- unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.RELATIONAL,
- sqlCall.getOperator().getName() + " is not supported\n" +
- "See Apache Drill JIRA: DRILL-1921");
- throw new UnsupportedOperationException();
- }
- }
-
// Disable unsupported JOINs
if(sqlCall.getKind() == SqlKind.JOIN) {
SqlJoin join = (SqlJoin) sqlCall;
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java b/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
index 5d8cd95..f53cc0f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
@@ -77,24 +77,6 @@ public class TestDisabledFunctionality extends BaseTestQuery{
}
}
- @Test(expected = UnsupportedRelOperatorException.class) // see DRILL-1921
- public void testDisabledUnion() throws Exception {
- try {
- test("(select n_name as name from cp.`tpch/nation.parquet`) UNION (select r_name as name from cp.`tpch/region.parquet`)");
- } catch(UserException ex) {
- throwAsUnsupportedException(ex);
- }
- }
-
- @Test(expected = UnsupportedRelOperatorException.class) // see DRILL-1921
- public void testDisabledUnionDistinct() throws Exception {
- try {
- test("(select n_name as name from cp.`tpch/nation.parquet`) UNION DISTINCT (select r_name as name from cp.`tpch/region.parquet`)");
- } catch(UserException ex) {
- throwAsUnsupportedException(ex);
- }
- }
-
@Test(expected = UnsupportedRelOperatorException.class) // see DRILL-1921
public void testDisabledIntersect() throws Exception {
try {
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java b/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
new file mode 100644
index 0000000..8f85b4d
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
@@ -0,0 +1,683 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill;
+
+import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.types.TypeProtos;
+import org.apache.drill.common.util.FileUtils;
+import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
+import org.apache.drill.exec.work.foreman.UnsupportedRelOperatorException;
+import org.junit.Test;
+
+public class TestUnionDistinct extends BaseTestQuery {
+ private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestUnionDistinct.class);
+
+ @Test // Simple Unionover two scans
+ public void testUnionDistinct1() throws Exception {
+ String query = "(select n_regionkey from cp.`tpch/nation.parquet`) union (select r_regionkey from cp.`tpch/region.parquet`)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q1.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_regionkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union over inner joins
+ public void testUnionDistinct2() throws Exception {
+ String query = "select n1.n_nationkey from cp.`tpch/nation.parquet` n1 inner join cp.`tpch/region.parquet` r1 on n1.n_regionkey = r1.r_regionkey where n1.n_nationkey in (1, 2) \n" +
+ "union \n" +
+ "select n2.n_nationkey from cp.`tpch/nation.parquet` n2 inner join cp.`tpch/region.parquet` r2 on n2.n_regionkey = r2.r_regionkey where n2.n_nationkey in (1, 2, 3, 4)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q2.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union over grouped aggregates
+ public void testUnionDistinct3() throws Exception {
+ String query = "select n1.n_nationkey from cp.`tpch/nation.parquet` n1 where n1.n_nationkey in (1, 2) group by n1.n_nationkey \n" +
+ "union \n" +
+ "select r1.r_regionkey from cp.`tpch/region.parquet` r1 group by r1.r_regionkey";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q3.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey")
+ .build()
+ .run();
+ }
+
+ @Test // Chain of Unions
+ public void testUnionDistinct4() throws Exception {
+ String query = "select n_regionkey from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey from cp.`tpch/region.parquet` \n" +
+ "union select n_nationkey from cp.`tpch/nation.parquet` \n" +
+ "union select c_custkey from cp.`tpch/customer.parquet` where c_custkey < 5";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q4.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_regionkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union of all columns in the table
+ public void testUnionDistinct5() throws Exception {
+ String query = "select r_name, r_comment, r_regionkey from cp.`tpch/region.parquet` r1 \n" +
+ "union \n" +
+ "select r_name, r_comment, r_regionkey from cp.`tpch/region.parquet` r2";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q5.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT)
+ .baselineColumns("r_name", "r_comment", "r_regionkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct where same column is projected twice in right child
+ public void testUnionDistinct6() throws Exception {
+ String query = "select n_nationkey, n_regionkey from cp.`tpch/nation.parquet` where n_regionkey = 1 \n" +
+ "union \n" +
+ "select r_regionkey, r_regionkey from cp.`tpch/region.parquet` where r_regionkey = 2";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q6.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey", "n_regionkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct where same column is projected twice in left and right child
+ public void testUnionDistinct6_1() throws Exception {
+ String query = "select n_nationkey, n_nationkey from cp.`tpch/nation.parquet` union \n" +
+ "select r_regionkey, r_regionkey from cp.`tpch/region.parquet`";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q6_1.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey", "n_nationkey0")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct of two string literals of different lengths
+ public void testUnionDistinct7() throws Exception {
+ String query = "select 'abc' as col from cp.`tpch/region.parquet` union \n" +
+ "select 'abcdefgh' from cp.`tpch/region.parquet`";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q7.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("col")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct of two character columns of different lengths
+ public void testUnionDistinct8() throws Exception {
+ String query = "select n_name, n_nationkey from cp.`tpch/nation.parquet` union \n" +
+ "select r_comment, r_regionkey from cp.`tpch/region.parquet`";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q8.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT)
+ .baselineColumns("n_name", "n_nationkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct of * column from JSON files in different directories
+ public void testUnionDistinct9() throws Exception {
+ String file0 = FileUtils.getResourceAsFile("/multilevel/json/1994/Q1/orders_94_q1.json").toURI().toString();
+ String file1 = FileUtils.getResourceAsFile("/multilevel/json/1995/Q1/orders_95_q1.json").toURI().toString();
+ String query = String.format("select o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment, o_orderkey from dfs_test.`%s` union \n" +
+ "select o_custkey, o_orderstatus, o_totalprice, o_orderdate, o_orderpriority, o_clerk, o_shippriority, o_comment, o_orderkey from dfs_test.`%s`", file0, file1);
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q9.tsv")
+ .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.FLOAT8, TypeProtos.MinorType.VARCHAR,
+ TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT,TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT)
+ .baselineColumns("o_custkey", "o_orderstatus", "o_totalprice", "o_orderdate",
+ "o_orderpriority", "o_clerk", "o_shippriority", "o_comment", "o_orderkey")
+ .build()
+ .run();
+ }
+
+ @Test // Union-Distinct constant literals
+ public void testUnionDistinct10() throws Exception {
+ String query = "(select n_name, 'LEFT' as LiteralConstant, n_nationkey, '1' as NumberConstant from cp.`tpch/nation.parquet`) \n" +
+ "union \n" +
+ "(select 'RIGHT', r_name, '2', r_regionkey from cp.`tpch/region.parquet`)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q10.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.INT)
+ .baselineColumns("n_name", "LiteralConstant", "n_nationkey", "NumberConstant")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testUnionDistinctViewExpandableStar() throws Exception {
+ test("use dfs_test.tmp");
+ test("create view nation_view_testunion as select n_name, n_nationkey from cp.`tpch/nation.parquet`;");
+ test("create view region_view_testunion as select r_name, r_regionkey from cp.`tpch/region.parquet`;");
+
+ String query1 = "(select * from dfs_test.tmp.`nation_view_testunion`) \n" +
+ "union \n" +
+ "(select * from dfs_test.tmp.`region_view_testunion`)";
+
+ String query2 = "(select r_name, r_regionkey from cp.`tpch/region.parquet`) \n" +
+ "union \n" +
+ "(select * from dfs_test.tmp.`nation_view_testunion`)";
+
+ try {
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q11.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT)
+ .baselineColumns("n_name", "n_nationkey")
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query2)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q12.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT)
+ .baselineColumns("r_name", "r_regionkey")
+ .build()
+ .run();
+ } finally {
+ test("drop view nation_view_testunion");
+ test("drop view region_view_testunion");
+ }
+ }
+
+ @Test(expected = UnsupportedRelOperatorException.class)
+ public void testUnionDistinctViewUnExpandableStar() throws Exception {
+ test("use dfs_test.tmp");
+ test("create view nation_view_testunion as select * from cp.`tpch/nation.parquet`;");
+
+ try {
+ String query = "(select * from dfs_test.tmp.`nation_view_testunion`) \n" +
+ "union (select * from cp.`tpch/region.parquet`)";
+ test(query);
+ } catch(UserException ex) {
+ SqlUnsupportedException.errorClassNameToException(ex.getOrCreatePBError(false).getException().getExceptionClass());
+ throw ex;
+ } finally {
+ test("drop view nation_view_testunion");
+ }
+ }
+
+ @Test
+ public void testDiffDataTypesAndModes() throws Exception {
+ test("use dfs_test.tmp");
+ test("create view nation_view_testunion as select n_name, n_nationkey from cp.`tpch/nation.parquet`;");
+ test("create view region_view_testunion as select r_name, r_regionkey from cp.`tpch/region.parquet`;");
+
+ String t1 = "(select n_comment, n_regionkey from cp.`tpch/nation.parquet` limit 5)";
+ String t2 = "(select * from nation_view_testunion limit 5)";
+ String t3 = "(select full_name, store_id from cp.`employee.json` limit 5)";
+ String t4 = "(select * from region_view_testunion limit 5)";
+
+ String query1 = t1 + " union " + t2 + " union " + t3 + " union " + t4;
+
+ try {
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q13.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT)
+ .baselineColumns("n_comment", "n_regionkey")
+ .build()
+ .run();
+ } finally {
+ test("drop view nation_view_testunion");
+ test("drop view region_view_testunion");
+ }
+ }
+
+ @Test
+ public void testDistinctOverUnionDistinctwithFullyQualifiedColumnNames() throws Exception {
+ String query = "select distinct sq.x1, sq.x2 \n" +
+ "from \n" +
+ "((select n_regionkey as a1, n_name as b1 from cp.`tpch/nation.parquet`) \n" +
+ "union \n" +
+ "(select r_regionkey as a2, r_name as b2 from cp.`tpch/region.parquet`)) as sq(x1,x2)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q14.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("x1", "x2")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testUnionDistinctContainsColumnANumericConstant() throws Exception {
+ String query = "(select n_nationkey, n_regionkey, n_name from cp.`tpch/nation.parquet` limit 5) \n" +
+ "union \n" +
+ "(select 1, n_regionkey, 'abc' from cp.`tpch/nation.parquet` limit 5)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q15.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("n_nationkey", "n_regionkey", "n_name")
+ .build().run();
+ }
+
+ @Test
+ public void testUnionDistinctEmptySides() throws Exception {
+ String query1 = "(select n_nationkey, n_regionkey, n_name from cp.`tpch/nation.parquet` limit 0) \n" +
+ "union \n" +
+ "(select 1, n_regionkey, 'abc' from cp.`tpch/nation.parquet` limit 5)";
+
+ String query2 = "(select n_nationkey, n_regionkey, n_name from cp.`tpch/nation.parquet` limit 5) \n" +
+ "union \n" +
+ "(select 1, n_regionkey, 'abc' from cp.`tpch/nation.parquet` limit 0)";
+
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q16.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("n_nationkey", "n_regionkey", "n_name")
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query2)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q17.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("n_nationkey", "n_regionkey", "n_name")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testAggregationOnUnionDistinctOperator() throws Exception {
+ String root = FileUtils.getResourceAsFile("/store/text/data/t.json").toURI().toString();
+ String query1 = String.format(
+ "(select calc1, max(b1) as `max`, min(b1) as `min`, count(c1) as `count` \n" +
+ "from (select a1 + 10 as calc1, b1, c1 from dfs_test.`%s` \n" +
+ "union \n" +
+ "select a1 + 100 as diff1, b1 as diff2, c1 as diff3 from dfs_test.`%s`) \n" +
+ "group by calc1 order by calc1)", root, root);
+
+ String query2 = String.format(
+ "(select calc1, min(b1) as `min`, max(b1) as `max`, count(c1) as `count` \n" +
+ "from (select a1 + 10 as calc1, b1, c1 from dfs_test.`%s` \n" +
+ "union \n" +
+ "select a1 + 100 as diff1, b1 as diff2, c1 as diff3 from dfs_test.`%s`) \n" +
+ "group by calc1 order by calc1)", root, root);
+
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testAggregationOnUnionDistinctOperator_1.tsv")
+ .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT)
+ .baselineColumns("calc1", "max", "min", "count")
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query2)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testAggregationOnUnionDistinctOperator_2.tsv")
+ .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT)
+ .baselineColumns("calc1", "min", "max", "count")
+ .build()
+ .run();
+ }
+
+ @Test(expected = UserException.class)
+ public void testUnionDistinctImplicitCastingFailure() throws Exception {
+ String rootInt = FileUtils.getResourceAsFile("/store/json/intData.json").toURI().toString();
+ String rootBoolean = FileUtils.getResourceAsFile("/store/json/booleanData.json").toURI().toString();
+
+ String query = String.format(
+ "(select key from dfs_test.`%s` \n" +
+ "union \n" +
+ "select key from dfs_test.`%s` )", rootInt, rootBoolean);
+
+ test(query);
+ }
+
+ @Test
+ public void testDateAndTimestampJson() throws Exception {
+ String rootDate = FileUtils.getResourceAsFile("/store/json/dateData.json").toURI().toString();
+ String rootTimpStmp = FileUtils.getResourceAsFile("/store/json/timeStmpData.json").toURI().toString();
+
+ String query1 = String.format(
+ "(select max(key) as key from dfs_test.`%s` \n" +
+ "union \n" +
+ "select key from dfs_test.`%s`)", rootDate, rootTimpStmp);
+
+ String query2 = String.format(
+ "select key from dfs_test.`%s` \n" +
+ "union \n" +
+ "select max(key) as key from dfs_test.`%s`", rootDate, rootTimpStmp);
+
+ String query3 = String.format(
+ "select key from dfs_test.`%s` \n" +
+ "union \n" +
+ "select max(key) as key from dfs_test.`%s`", rootDate, rootTimpStmp);
+
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q18_1.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("key")
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query2)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q18_2.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("key")
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query3)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/q18_3.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("key")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testUnionDistinctOneInputContainsAggFunction() throws Exception {
+ String root = FileUtils.getResourceAsFile("/multilevel/csv/1994/Q1/orders_94_q1.csv").toURI().toString();
+ String query1 = String.format("select * from ((select count(c1) as ct from (select columns[0] c1 from dfs.`%s`)) \n" +
+ "union \n" +
+ "(select columns[0] c2 from dfs.`%s`)) order by ct limit 3", root, root);
+
+ String query2 = String.format("select * from ((select columns[0] ct from dfs.`%s`) \n" +
+ "union \n" +
+ "(select count(c1) as c2 from (select columns[0] c1 from dfs.`%s`))) order by ct limit 3", root, root);
+
+ String query3 = String.format("select * from ((select count(c1) as ct from (select columns[0] c1 from dfs.`%s`) )\n" +
+ "union \n" +
+ "(select count(c1) as c2 from (select columns[0] c1 from dfs.`%s`))) order by ct", root, root);
+
+ testBuilder()
+ .sqlQuery(query1)
+ .unOrdered()
+ .baselineColumns("ct")
+ .baselineValues((long) 10)
+ .baselineValues((long) 66)
+ .baselineValues((long) 99)
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query2)
+ .unOrdered()
+ .baselineColumns("ct")
+ .baselineValues((long) 10)
+ .baselineValues((long) 66)
+ .baselineValues((long) 99)
+ .build()
+ .run();
+
+ testBuilder()
+ .sqlQuery(query3)
+ .unOrdered()
+ .baselineColumns("ct")
+ .baselineValues((long) 10)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testUnionDistinctDiffTypesAtPlanning() throws Exception {
+ String query = "select count(c1) as ct from (select cast(r_regionkey as int) c1 from cp.`tpch/region.parquet`) \n" +
+ "union \n" +
+ "(select cast(r_regionkey as int) c2 from cp.`tpch/region.parquet`)";
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("ct")
+ .baselineValues((long) 5)
+ .baselineValues((long) 0)
+ .baselineValues((long) 1)
+ .baselineValues((long) 2)
+ .baselineValues((long) 3)
+ .baselineValues((long) 4)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testUnionDistinctRightEmptyJson() throws Exception {
+ String rootEmpty = FileUtils.getResourceAsFile("/project/pushdown/empty.json").toURI().toString();
+ String rootSimple = FileUtils.getResourceAsFile("/store/json/booleanData.json").toURI().toString();
+
+ String queryRightEmpty = String.format(
+ "select key from dfs_test.`%s` \n" +
+ "union \n" +
+ "select key from dfs_test.`%s`", rootSimple, rootEmpty);
+
+ testBuilder()
+ .sqlQuery(queryRightEmpty)
+ .unOrdered()
+ .baselineColumns("key")
+ .baselineValues(true)
+ .baselineValues(false)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testFilterPushDownOverUnionDistinct() throws Exception {
+ String query = "select n_regionkey from \n"
+ + "(select n_regionkey from cp.`tpch/nation.parquet` union select r_regionkey from cp.`tpch/region.parquet`) \n"
+ + "where n_regionkey > 0 and n_regionkey < 2 \n"
+ + "order by n_regionkey";
+
+ testBuilder()
+ .sqlQuery(query)
+ .ordered()
+ .baselineColumns("n_regionkey")
+ .baselineValues(1)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testInListPushDownOverUnionDistinct() throws Exception {
+ String query = "select n_nationkey \n" +
+ "from (select n1.n_nationkey from cp.`tpch/nation.parquet` n1 inner join cp.`tpch/region.parquet` r1 on n1.n_regionkey = r1.r_regionkey \n" +
+ "union \n" +
+ "select n2.n_nationkey from cp.`tpch/nation.parquet` n2 inner join cp.`tpch/region.parquet` r2 on n2.n_regionkey = r2.r_regionkey) \n" +
+ "where n_nationkey in (1, 2)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("n_nationkey")
+ .baselineValues(1)
+ .baselineValues(2)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testFilterPushDownOverUnionDistinctCSV() throws Exception {
+ String root = FileUtils.getResourceAsFile("/multilevel/csv/1994/Q1/orders_94_q1.csv").toURI().toString();
+ String query = String.format("select ct \n" +
+ "from ((select count(c1) as ct from (select columns[0] c1 from dfs.`%s`)) \n" +
+ "union \n" +
+ "(select columns[0] c2 from dfs.`%s`)) \n" +
+ "where ct < 100", root, root);
+
+ testBuilder()
+ .sqlQuery(query)
+ .ordered()
+ .baselineColumns("ct")
+ .baselineValues((long) 10)
+ .baselineValues((long) 66)
+ .baselineValues((long) 99)
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectPushDownOverUnionDistinctWithProject() throws Exception {
+ String query = "select n_nationkey, n_name from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey, r_name, r_comment from cp.`tpch/region.parquet`)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithProject.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("n_nationkey", "n_name")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectPushDownOverUnionDistinctWithoutProject() throws Exception {
+ String query = "select n_nationkey from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey, r_name, r_comment from cp.`tpch/region.parquet`)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithoutProject.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectWithExpressionPushDownOverUnionDistinct() throws Exception {
+ String query = "select 2 * n_nationkey as col from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey, r_name, r_comment from cp.`tpch/region.parquet`)";
+
+ // Validate the result
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectWithExpressionPushDownOverUnionDistinct.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("col")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectDownOverUnionDistinctImplicitCasting() throws Exception {
+ String root = FileUtils.getResourceAsFile("/store/text/data/nations.csv").toURI().toString();
+ String query = String.format("select 2 * n_nationkey as col from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select columns[0], columns[1], columns[2] from dfs.`%s`) \n" +
+ "order by col limit 10", root);
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectDownOverUnionDistinctImplicitCasting.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("col")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectPushDownProjectColumnReorderingAndAlias() throws Exception {
+ String query = "select n_comment as col1, n_nationkey as col2, n_name as col3 from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey, r_name, r_comment from cp.`tpch/region.parquet`)";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectPushDownProjectColumnReorderingAndAlias.tsv")
+ .baselineTypes(TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.INT, TypeProtos.MinorType.VARCHAR)
+ .baselineColumns("col1", "col2", "col3")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void testProjectFiltertPushDownOverUnionDistinct() throws Exception {
+ String query = "select n_nationkey from \n" +
+ "(select n_nationkey, n_name, n_comment from cp.`tpch/nation.parquet` \n" +
+ "union select r_regionkey, r_name, r_comment from cp.`tpch/region.parquet`) \n" +
+ "where n_nationkey > 0 and n_nationkey < 4";
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .csvBaselineFile("testframework/testUnionDistinctQueries/testProjectFiltertPushDownOverUnionDistinct.tsv")
+ .baselineTypes(TypeProtos.MinorType.INT)
+ .baselineColumns("n_nationkey")
+ .build()
+ .run();
+ }
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q1.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q1.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q1.tsv
new file mode 100644
index 0000000..0254fe8
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q1.tsv
@@ -0,0 +1,5 @@
+0
+1
+4
+3
+2
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q10.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q10.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q10.tsv
new file mode 100644
index 0000000..c883125
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q10.tsv
@@ -0,0 +1,30 @@
+ALGERIA LEFT 0 1
+ARGENTINA LEFT 1 1
+BRAZIL LEFT 2 1
+CANADA LEFT 3 1
+EGYPT LEFT 4 1
+ETHIOPIA LEFT 5 1
+FRANCE LEFT 6 1
+GERMANY LEFT 7 1
+INDIA LEFT 8 1
+INDONESIA LEFT 9 1
+IRAN LEFT 10 1
+IRAQ LEFT 11 1
+JAPAN LEFT 12 1
+JORDAN LEFT 13 1
+KENYA LEFT 14 1
+MOROCCO LEFT 15 1
+MOZAMBIQUE LEFT 16 1
+PERU LEFT 17 1
+CHINA LEFT 18 1
+ROMANIA LEFT 19 1
+SAUDI ARABIA LEFT 20 1
+VIETNAM LEFT 21 1
+RUSSIA LEFT 22 1
+UNITED KINGDOM LEFT 23 1
+UNITED STATES LEFT 24 1
+RIGHT AFRICA 2 0
+RIGHT AMERICA 2 1
+RIGHT ASIA 2 2
+RIGHT EUROPE 2 3
+RIGHT MIDDLE EAST 2 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q11.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q11.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q11.tsv
new file mode 100644
index 0000000..2d5b701
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q11.tsv
@@ -0,0 +1,30 @@
+ALGERIA 0
+ARGENTINA 1
+BRAZIL 2
+CANADA 3
+EGYPT 4
+ETHIOPIA 5
+FRANCE 6
+GERMANY 7
+INDIA 8
+INDONESIA 9
+IRAN 10
+IRAQ 11
+JAPAN 12
+JORDAN 13
+KENYA 14
+MOROCCO 15
+MOZAMBIQUE 16
+PERU 17
+CHINA 18
+ROMANIA 19
+SAUDI ARABIA 20
+VIETNAM 21
+RUSSIA 22
+UNITED KINGDOM 23
+UNITED STATES 24
+AFRICA 0
+AMERICA 1
+ASIA 2
+EUROPE 3
+MIDDLE EAST 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q12.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q12.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q12.tsv
new file mode 100644
index 0000000..44f9209
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q12.tsv
@@ -0,0 +1,30 @@
+AFRICA 0
+AMERICA 1
+ASIA 2
+EUROPE 3
+MIDDLE EAST 4
+ALGERIA 0
+ARGENTINA 1
+BRAZIL 2
+CANADA 3
+EGYPT 4
+ETHIOPIA 5
+FRANCE 6
+GERMANY 7
+INDIA 8
+INDONESIA 9
+IRAN 10
+IRAQ 11
+JAPAN 12
+JORDAN 13
+KENYA 14
+MOROCCO 15
+MOZAMBIQUE 16
+PERU 17
+CHINA 18
+ROMANIA 19
+SAUDI ARABIA 20
+VIETNAM 21
+RUSSIA 22
+UNITED KINGDOM 23
+UNITED STATES 24
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q13.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q13.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q13.tsv
new file mode 100644
index 0000000..a207902
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q13.tsv
@@ -0,0 +1,20 @@
+ haggle. carefully final deposits detect slyly agai 0
+al foxes promise slyly according to the regular accounts. bold requests alon 1
+y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 1
+eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold 1
+y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d 4
+ALGERIA 0
+ARGENTINA 1
+BRAZIL 2
+CANADA 3
+EGYPT 4
+Sheri Nowmer 0
+Derrick Whelply 0
+Michael Spence 0
+Maya Gutierrez 0
+Roberta Damstra 0
+AFRICA 0
+AMERICA 1
+ASIA 2
+EUROPE 3
+MIDDLE EAST 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q14.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q14.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q14.tsv
new file mode 100644
index 0000000..754dca8
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q14.tsv
@@ -0,0 +1,30 @@
+0 ALGERIA
+1 ARGENTINA
+1 BRAZIL
+1 CANADA
+4 EGYPT
+0 ETHIOPIA
+3 FRANCE
+3 GERMANY
+2 INDIA
+2 INDONESIA
+4 IRAN
+4 IRAQ
+2 JAPAN
+4 JORDAN
+0 KENYA
+0 MOROCCO
+0 MOZAMBIQUE
+1 PERU
+2 CHINA
+3 ROMANIA
+4 SAUDI ARABIA
+2 VIETNAM
+3 RUSSIA
+3 UNITED KINGDOM
+1 UNITED STATES
+0 AFRICA
+1 AMERICA
+2 ASIA
+3 EUROPE
+4 MIDDLE EAST
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q15.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q15.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q15.tsv
new file mode 100644
index 0000000..e142333
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q15.tsv
@@ -0,0 +1,8 @@
+0 0 ALGERIA
+1 1 ARGENTINA
+2 1 BRAZIL
+3 1 CANADA
+4 4 EGYPT
+1 0 abc
+1 1 abc
+1 4 abc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q16.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q16.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q16.tsv
new file mode 100644
index 0000000..aa6e733
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q16.tsv
@@ -0,0 +1,3 @@
+1 0 abc
+1 1 abc
+1 4 abc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q17.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q17.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q17.tsv
new file mode 100644
index 0000000..27aa989
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q17.tsv
@@ -0,0 +1,5 @@
+0 0 ALGERIA
+1 1 ARGENTINA
+2 1 BRAZIL
+3 1 CANADA
+4 4 EGYPT
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_1.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_1.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_1.tsv
new file mode 100644
index 0000000..5cb3a5e
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_1.tsv
@@ -0,0 +1,4 @@
+2011-07-26
+2015-03-26 19:04:55.542
+2015-03-26 19:04:55.543
+2015-03-26 19:04:55.544
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_2.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_2.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_2.tsv
new file mode 100644
index 0000000..123efc6
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_2.tsv
@@ -0,0 +1,13 @@
+2009-03-03
+2001-08-27
+2011-07-26
+1970-09-02
+1983-04-24
+2007-02-01
+1977-08-03
+1962-05-14
+1950-02-16
+1983-09-05
+2000-09-09
+1960-08-18
+2015-03-26 19:04:55.544
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_3.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_3.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_3.tsv
new file mode 100644
index 0000000..123efc6
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q18_3.tsv
@@ -0,0 +1,13 @@
+2009-03-03
+2001-08-27
+2011-07-26
+1970-09-02
+1983-04-24
+2007-02-01
+1977-08-03
+1962-05-14
+1950-02-16
+1983-09-05
+2000-09-09
+1960-08-18
+2015-03-26 19:04:55.544
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q2.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q2.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q2.tsv
new file mode 100644
index 0000000..b178657
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q2.tsv
@@ -0,0 +1,4 @@
+1
+2
+3
+4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q3.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q3.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q3.tsv
new file mode 100644
index 0000000..59dd464
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q3.tsv
@@ -0,0 +1,5 @@
+1
+2
+0
+3
+4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q4.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q4.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q4.tsv
new file mode 100644
index 0000000..7472138
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q4.tsv
@@ -0,0 +1,25 @@
+0
+1
+4
+3
+2
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q5.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q5.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q5.tsv
new file mode 100644
index 0000000..b803523
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q5.tsv
@@ -0,0 +1,5 @@
+AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 0
+AMERICA hs use ironic, even requests. s 1
+ASIA ges. thinly even pinto beans ca 2
+EUROPE ly final courts cajole furiously final excuse 3
+MIDDLE EAST uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6.tsv
new file mode 100644
index 0000000..e7127dd
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6.tsv
@@ -0,0 +1,6 @@
+1 1
+2 1
+3 1
+17 1
+24 1
+2 2
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6_1.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6_1.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6_1.tsv
new file mode 100644
index 0000000..d32c846
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q6_1.tsv
@@ -0,0 +1,25 @@
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+21 21
+22 22
+23 23
+24 24
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q7.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q7.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q7.tsv
new file mode 100644
index 0000000..3e75b5f
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q7.tsv
@@ -0,0 +1,2 @@
+abc
+abcdefgh
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q8.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q8.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q8.tsv
new file mode 100644
index 0000000..4e9cb34
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q8.tsv
@@ -0,0 +1,30 @@
+ALGERIA 0
+ARGENTINA 1
+BRAZIL 2
+CANADA 3
+EGYPT 4
+ETHIOPIA 5
+FRANCE 6
+GERMANY 7
+INDIA 8
+INDONESIA 9
+IRAN 10
+IRAQ 11
+JAPAN 12
+JORDAN 13
+KENYA 14
+MOROCCO 15
+MOZAMBIQUE 16
+PERU 17
+CHINA 18
+ROMANIA 19
+SAUDI ARABIA 20
+VIETNAM 21
+RUSSIA 22
+UNITED KINGDOM 23
+UNITED STATES 24
+lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 0
+hs use ironic, even requests. s 1
+ges. thinly even pinto beans ca 2
+ly final courts cajole furiously final excuse 3
+uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q9.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q9.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q9.tsv
new file mode 100644
index 0000000..2fd5e7b
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/q9.tsv
@@ -0,0 +1,20 @@
+1292 F 104190.66 1994-01-20T00:00:00.000-08:00 5-LOW Clerk#000000743 0 y pending requests integrate 66
+890 F 108594.87 1994-03-13T00:00:00.000-08:00 4-NOT SPECIFIED Clerk#000000973 0 e carefully ironic packages. pending 99
+1180 F 67636.54 1994-01-01T00:00:00.000-08:00 4-NOT SPECIFIED Clerk#000000735 0 efully dogged deposits. furiou 290
+1411 F 88375.89 1994-03-13T00:00:00.000-08:00 1-URGENT Clerk#000000923 0 dolites. carefully regular pinto beans cajol 291
+392 F 121127.17 1994-03-26T00:00:00.000-08:00 1-URGENT Clerk#000000959 0 arefully pending foxes sleep blithely. slyly express accoun 323
+1066 F 25542.02 1994-03-08T00:00:00.000-08:00 2-HIGH Clerk#000000932 0 ke slyly bold pinto beans. blithely regular accounts against the spe 352
+1270 F 3266.69 1994-02-17T00:00:00.000-08:00 2-HIGH Clerk#000000062 0 ing to the regular asymptotes. final, pending foxes about the blithely sil 389
+547 F 132531.73 1994-02-06T00:00:00.000-08:00 3-MEDIUM Clerk#000000468 0 ironic, even packages. thinly unusual accounts sleep along the slyly unusual 417
+793 F 34950.94 1994-03-10T00:00:00.000-08:00 1-URGENT Clerk#000000448 0 special pinto beans use quickly furiously even depende 673
+553 F 53948.73 1994-02-13T00:00:00.000-08:00 3-MEDIUM Clerk#000000437 0 ts haggle quickly across the slyl 833
+163 P 95469.44 1995-03-18T00:00:00.000-08:00 1-URGENT Clerk#000000632 0 ular requests are blithely pending orbits-- even requests against the deposit 65
+602 F 119718.02 1995-01-25T00:00:00.000-08:00 2-HIGH Clerk#000000648 0 haggle quickly. stealthily bold asymptotes haggle among the furiously even re 386
+475 P 213638.07 1995-03-05T00:00:00.000-08:00 4-NOT SPECIFIED Clerk#000000293 0 d theodolites. boldly bold foxes since the pack 450
+578 P 261882.19 1995-03-25T00:00:00.000-08:00 2-HIGH Clerk#000000354 0 g dependencies. regular accounts 643
+1333 F 75392.93 1995-03-18T00:00:00.000-08:00 1-URGENT Clerk#000000191 0 kly express requests. fluffily silent accounts poach furiously 775
+1367 F 192178.48 1995-01-05T00:00:00.000-08:00 1-URGENT Clerk#000000516 0 posits. ironic, pending requests cajole. even theodol 802
+490 P 88281.28 1995-03-20T00:00:00.000-08:00 1-URGENT Clerk#000000316 0 wake quickly against 897
+658 F 315638.02 1995-03-02T00:00:00.000-08:00 5-LOW Clerk#000000450 0 ithely express pinto beans. 928
+275 F 41838.38 1995-02-11T00:00:00.000-08:00 1-URGENT Clerk#000000125 0 t, even deposits hang about the slyly special i 1056
+1232 P 131664.83 1995-03-04T00:00:00.000-08:00 3-MEDIUM Clerk#000000006 0 re quickly along the blithe 1092
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_1.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_1.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_1.tsv
new file mode 100644
index 0000000..d114555
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_1.tsv
@@ -0,0 +1,4 @@
+10 2 1 4
+20 5 3 4
+100 2 1 4
+110 5 3 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_2.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_2.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_2.tsv
new file mode 100644
index 0000000..53d874e
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testAggregationOnUnionDistinctOperator_2.tsv
@@ -0,0 +1,4 @@
+10 1 2 4
+20 3 5 4
+100 1 2 4
+110 3 5 4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectDownOverUnionDistinctImplicitCasting.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectDownOverUnionDistinctImplicitCasting.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectDownOverUnionDistinctImplicitCasting.tsv
new file mode 100644
index 0000000..7c84ba7
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectDownOverUnionDistinctImplicitCasting.tsv
@@ -0,0 +1,10 @@
+0
+0
+2
+2
+4
+4
+6
+6
+8
+8
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectFiltertPushDownOverUnionDistinct.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectFiltertPushDownOverUnionDistinct.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectFiltertPushDownOverUnionDistinct.tsv
new file mode 100644
index 0000000..c7a7ace
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectFiltertPushDownOverUnionDistinct.tsv
@@ -0,0 +1,6 @@
+1
+2
+3
+1
+2
+3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithProject.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithProject.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithProject.tsv
new file mode 100644
index 0000000..7d708b0
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithProject.tsv
@@ -0,0 +1,30 @@
+0 ALGERIA
+1 ARGENTINA
+2 BRAZIL
+3 CANADA
+4 EGYPT
+5 ETHIOPIA
+6 FRANCE
+7 GERMANY
+8 INDIA
+9 INDONESIA
+10 IRAN
+11 IRAQ
+12 JAPAN
+13 JORDAN
+14 KENYA
+15 MOROCCO
+16 MOZAMBIQUE
+17 PERU
+18 CHINA
+19 ROMANIA
+20 SAUDI ARABIA
+21 VIETNAM
+22 RUSSIA
+23 UNITED KINGDOM
+24 UNITED STATES
+0 AFRICA
+1 AMERICA
+2 ASIA
+3 EUROPE
+4 MIDDLE EAST
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithoutProject.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithoutProject.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithoutProject.tsv
new file mode 100644
index 0000000..c977edd
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownOverUnionDistinctWithoutProject.tsv
@@ -0,0 +1,30 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+0
+1
+2
+3
+4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownProjectColumnReorderingAndAlias.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownProjectColumnReorderingAndAlias.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownProjectColumnReorderingAndAlias.tsv
new file mode 100644
index 0000000..05bb0ff
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectPushDownProjectColumnReorderingAndAlias.tsv
@@ -0,0 +1,30 @@
+ haggle. carefully final deposits detect slyly agai 0 ALGERIA
+al foxes promise slyly according to the regular accounts. bold requests alon 1 ARGENTINA
+y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special 2 BRAZIL
+eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold 3 CANADA
+y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d 4 EGYPT
+ven packages wake quickly. regu 5 ETHIOPIA
+refully final requests. regular, ironi 6 FRANCE
+l platelets. regular accounts x-ray: unusual, regular acco 7 GERMANY
+ss excuses cajole slyly across the packages. deposits print aroun 8 INDIA
+ slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull 9 INDONESIA
+efully alongside of the slyly final dependencies. 10 IRAN
+nic deposits boost atop the quickly final requests? quickly regula 11 IRAQ
+ously. final, express gifts cajole a 12 JAPAN
+ic deposits are blithely about the carefully regular pa 13 JORDAN
+ pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t 14 KENYA
+rns. blithely bold courts among the closely regular packages use furiously bold platelets? 15 MOROCCO
+s. ironic, unusual asymptotes wake blithely r 16 MOZAMBIQUE
+platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun 17 PERU
+c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos 18 CHINA
+ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account 19 ROMANIA
+ts. silent requests haggle. closely express packages sleep across the blithely 20 SAUDI ARABIA
+hely enticingly express accounts. even, final 21 VIETNAM
+ requests against the platelets use never according to the quickly regular pint 22 RUSSIA
+eans boost carefully special requests. accounts are. carefull 23 UNITED KINGDOM
+y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be 24 UNITED STATES
+lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to 0 AFRICA
+hs use ironic, even requests. s 1 AMERICA
+ges. thinly even pinto beans ca 2 ASIA
+ly final courts cajole furiously final excuse 3 EUROPE
+uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl 4 MIDDLE EAST
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/drill/blob/45a82c45/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectWithExpressionPushDownOverUnionDistinct.tsv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectWithExpressionPushDownOverUnionDistinct.tsv b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectWithExpressionPushDownOverUnionDistinct.tsv
new file mode 100644
index 0000000..4a9efcd
--- /dev/null
+++ b/exec/java-exec/src/test/resources/testframework/TestUnionDistinctQueries/testProjectWithExpressionPushDownOverUnionDistinct.tsv
@@ -0,0 +1,30 @@
+0
+2
+4
+6
+8
+10
+12
+14
+16
+18
+20
+22
+24
+26
+28
+30
+32
+34
+36
+38
+40
+42
+44
+46
+48
+0
+2
+4
+6
+8
\ No newline at end of file