From f21a226b832810d98d675c0898c0c4b9e5660639 Mon Sep 17 00:00:00 2001 From: Hsuan-Yi Chu Date: Tue, 17 Mar 2015 14:42:32 -0700 Subject: [PATCH] DRILL-2139: Support distinct over star column --- .../impl/aggregate/AggregateUtils.java | 77 ++++++++ .../physical/impl/aggregate/HashAggBatch.java | 22 +-- .../impl/aggregate/StreamingAggBatch.java | 18 +- .../impl/xsort/ExternalSortBatch.java | 53 +++++- .../org/apache/drill/TestDistinctStar.java | 167 ++++++++++++++++++ .../exec/physical/impl/agg/TestHashAggr.java | 3 +- .../store/text/data/repeatedRows.json | 10 ++ .../testDistinctStar/testSelectDistinct.tsv | 5 + .../testSelectDistinctExpression.tsv | 5 + .../testSelectDistinctOverJoin.tsv | 13 ++ 10 files changed, 354 insertions(+), 19 deletions(-) create mode 100644 exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/AggregateUtils.java create mode 100644 exec/java-exec/src/test/java/org/apache/drill/TestDistinctStar.java create mode 100644 exec/java-exec/src/test/resources/store/text/data/repeatedRows.json create mode 100644 exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinct.tsv create mode 100644 exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctExpression.tsv create mode 100644 exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctOverJoin.tsv diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/AggregateUtils.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/AggregateUtils.java new file mode 100644 index 00000000000..1979c40db94 --- /dev/null +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/AggregateUtils.java @@ -0,0 +1,77 @@ +/** + * 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.physical.impl.aggregate; + +import org.apache.drill.common.expression.FieldReference; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.common.logical.data.NamedExpression; +import org.apache.drill.exec.planner.StarColumnHelper; +import org.apache.drill.exec.record.BatchSchema; + +import com.google.common.collect.Lists; + +import java.util.List; + +public class AggregateUtils { + /** + * Given the grouping keys and the incomingSchema, + * if the key is * or prefixed * (i.e., T# || *), expand it according to the incomingSchema and add to the output list; + * if it is not, just add it to the output list + * @param keys grouping keys, which could be * (or prefixed *) + * @param incomingSchema BatchSchema of the incoming record batch + * @return the expanded list of grouping keys + */ + public static List expandGroupByColumns(final NamedExpression[] keys, final BatchSchema incomingSchema) { + final List groupedCols = Lists.newArrayList(); + for(int i = 0; keys != null && i < keys.length; ++i) { + final SchemaPath expr = (SchemaPath) keys[i].getExpr(); + final String exprPath = expr.getRootSegment().getPath(); + // If the sorting column has * + if(exprPath.contains(StarColumnHelper.STAR_COLUMN)) { + final boolean exprHasPrefix = exprPath.contains(StarColumnHelper.PREFIX_DELIMITER); + + // If the sorting column is T# || * + if(exprHasPrefix) { + final String prefix = exprPath.substring(0, exprPath.indexOf(StarColumnHelper.PREFIX_DELIMITER)); + + for(int indexCol = 0; indexCol < incomingSchema.getFieldCount(); ++indexCol) { + final SchemaPath incomingPath = incomingSchema.getColumn(indexCol).getPath(); + if(incomingPath.getRootSegment().getPath().startsWith(prefix)) { + final NamedExpression ne = new NamedExpression(incomingPath, + new FieldReference(incomingPath)); + groupedCols.add(ne); + } + } + // If the sorting column has * + } else { + for(int indexCol = 0; indexCol < incomingSchema.getFieldCount(); ++indexCol) { + final SchemaPath incomingPath = incomingSchema.getColumn(indexCol).getPath(); + final NamedExpression ne = new NamedExpression(incomingPath, + new FieldReference(incomingPath)); + groupedCols.add(ne); + } + } + } else { + groupedCols.add(keys[i]); + } + } + + return groupedCols; + } +} diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java index 8a7d705c5fc..1069eb27b35 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java @@ -18,6 +18,7 @@ package org.apache.drill.exec.physical.impl.aggregate; import java.io.IOException; +import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.exceptions.UserException; @@ -182,18 +183,19 @@ private HashAggregator createAggregatorInternal() throws SchemaChangeException, container.clear(); - int numGroupByExprs = (popConfig.getGroupByExprs() != null) ? popConfig.getGroupByExprs().length : 0; - int numAggrExprs = (popConfig.getAggrExprs() != null) ? popConfig.getAggrExprs().length : 0; + List groupedCols = AggregateUtils.expandGroupByColumns(popConfig.getGroupByExprs(), incoming.getSchema()); + final int numAggrExprs = (popConfig.getAggrExprs() != null) ? popConfig.getAggrExprs().length : 0; aggrExprs = new LogicalExpression[numAggrExprs]; - groupByOutFieldIds = new TypedFieldId[numGroupByExprs]; + groupByOutFieldIds = new TypedFieldId[groupedCols.size()]; aggrOutFieldIds = new TypedFieldId[numAggrExprs]; ErrorCollector collector = new ErrorCollectorImpl(); - int i; + NamedExpression[] namedExpressions = new NamedExpression[groupedCols.size()]; + for (int i = 0; i < groupedCols.size(); i++) { + NamedExpression ne = groupedCols.get(i); - for (i = 0; i < numGroupByExprs; i++) { - NamedExpression ne = popConfig.getGroupByExprs()[i]; + namedExpressions[i] = ne; final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector, context.getFunctionRegistry()); if (expr == null) { @@ -207,7 +209,7 @@ private HashAggregator createAggregatorInternal() throws SchemaChangeException, groupByOutFieldIds[i] = container.add(vv); } - for (i = 0; i < numAggrExprs; i++) { + for (int i = 0; i < numAggrExprs; i++) { NamedExpression ne = popConfig.getAggrExprs()[i]; final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector, context.getFunctionRegistry()); @@ -240,8 +242,9 @@ private HashAggregator createAggregatorInternal() throws SchemaChangeException, HashTableConfig htConfig = new HashTableConfig(context.getOptions().getOption(ExecConstants.MIN_HASH_TABLE_SIZE_KEY).num_val.intValue(), - HashTable.DEFAULT_LOAD_FACTOR, popConfig.getGroupByExprs(), null /* no probe exprs */); - + HashTable.DEFAULT_LOAD_FACTOR, + namedExpressions, + null /* no probe exprs */); agg.setup(popConfig, htConfig, context, this.stats, oContext.getAllocator(), incoming, this, aggrExprs, @@ -295,5 +298,4 @@ public void close() { protected void killIncoming(boolean sendUpstream) { incoming.kill(sendUpstream); } - } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java index 89122c8aafa..cb74744c8a1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.physical.impl.aggregate; -import java.io.IOException; - import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.exceptions.UserException; import org.apache.drill.common.expression.ErrorCollector; @@ -54,6 +52,8 @@ import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.FixedWidthVector; import org.apache.drill.exec.vector.ValueVector; +import java.io.IOException; +import java.util.List; import com.sun.codemodel.JExpr; import com.sun.codemodel.JVar; @@ -91,8 +91,9 @@ public StreamingAggBatch(StreamingAggregate popConfig, RecordBatch incoming, Fra public int getRecordCount() { if (done || aggregator == null) { return 0; + } else { + return recordCount; } - return recordCount; } @Override @@ -260,14 +261,19 @@ private StreamingAggregator createAggregatorInternal() throws SchemaChangeExcept ClassGenerator cg = CodeGenerator.getRoot(StreamingAggTemplate.TEMPLATE_DEFINITION, context.getFunctionRegistry()); container.clear(); - LogicalExpression[] keyExprs = new LogicalExpression[popConfig.getKeys().length]; + LogicalExpression[] keyExprs; + TypedFieldId[] keyOutputIds; + + List groupKeys = AggregateUtils.expandGroupByColumns(popConfig.getKeys(), incoming.getSchema()); + keyExprs = new LogicalExpression[groupKeys.size()]; + keyOutputIds = new TypedFieldId[groupKeys.size()]; + LogicalExpression[] valueExprs = new LogicalExpression[popConfig.getExprs().length]; - TypedFieldId[] keyOutputIds = new TypedFieldId[popConfig.getKeys().length]; ErrorCollector collector = new ErrorCollectorImpl(); for (int i = 0; i < keyExprs.length; i++) { - final NamedExpression ne = popConfig.getKeys()[i]; + final NamedExpression ne = groupKeys.get(i); final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector,context.getFunctionRegistry() ); if (expr == null) { continue; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java index 49a64cfee79..4f63ffea824 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatch.java @@ -27,11 +27,14 @@ import java.util.concurrent.TimeUnit; import org.apache.drill.common.AutoCloseables; +import org.apache.calcite.rel.RelFieldCollation; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.UserException; import org.apache.drill.common.expression.ErrorCollector; import org.apache.drill.common.expression.ErrorCollectorImpl; import org.apache.drill.common.expression.LogicalExpression; +import org.apache.drill.common.expression.PathSegment; +import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.data.Order.Ordering; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.compile.sig.GeneratorMapping; @@ -53,6 +56,7 @@ import org.apache.drill.exec.physical.impl.sort.SortRecordBatchBuilder; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.helper.QueryIdHelper; +import org.apache.drill.exec.planner.StarColumnHelper; import org.apache.drill.exec.record.AbstractRecordBatch; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; @@ -663,7 +667,8 @@ private VectorContainer constructHyperBatch(List batchGroupList) { } private MSorter createNewMSorter() throws ClassTransformationException, IOException, SchemaChangeException { - return createNewMSorter(this.context, this.popConfig.getOrderings(), this, MAIN_MAPPING, LEFT_MAPPING, RIGHT_MAPPING); + List orderings = columnExpansion(); + return createNewMSorter(this.context, orderings, this, MAIN_MAPPING, LEFT_MAPPING, RIGHT_MAPPING); } private MSorter createNewMSorter(FragmentContext context, List orderings, VectorAccessible batch, MappingSet mainMapping, MappingSet leftMapping, MappingSet rightMapping) @@ -721,7 +726,8 @@ public SingleBatchSorter createNewSorter(FragmentContext context, VectorAccessib private void generateComparisons(ClassGenerator g, VectorAccessible batch) throws SchemaChangeException { g.setMappingSet(MAIN_MAPPING); - for (Ordering od : popConfig.getOrderings()) { + List orderings = columnExpansion(); + for (Ordering od : orderings) { // first, we rewrite the evaluation stack for each side of the comparison. ErrorCollector collector = new ErrorCollectorImpl(); final LogicalExpression expr = ExpressionTreeMaterializer.materialize(od.getExpr(), batch, collector,context.getFunctionRegistry()); @@ -791,4 +797,47 @@ protected void killIncoming(boolean sendUpstream) { incoming.kill(sendUpstream); } + private List columnExpansion() { + List orderings = Lists.newArrayList(); + Direction direction = this.popConfig.getOrderings().get(0).getDirection(); + RelFieldCollation.NullDirection nullDirection = this.popConfig.getOrderings().get(0).getNullDirection(); + + // Expand the star column + for(Ordering ordering : this.popConfig.getOrderings()) { + // If the sorting column is * + final PathSegment.NameSegment expr = ((SchemaPath) ordering.getExpr()).getRootSegment(); + final boolean exprHasStar = expr.getPath().contains(StarColumnHelper.STAR_COLUMN); + final boolean exprHasPrefix = expr.getPath().contains(StarColumnHelper.PREFIX_DELIMITER); + + // If the sorting column has * + if(exprHasStar) { + // If the sorting column is T# || * + if(exprHasPrefix) { + String prefix = expr.getPath().substring(0, + expr.getPath().indexOf(StarColumnHelper.PREFIX_DELIMITER)); + + for(int i = 0; i < incoming.getSchema().getFieldCount(); ++i) { + if(incoming.getSchema().getColumn(i).getPath().getRootSegment().getPath().startsWith(prefix)) { + Ordering expandOrdering = new Ordering(incoming.getSchema().getColumn(i).getPath(), + direction.shortString, + nullDirection.name()); + orderings.add(expandOrdering); + } + } + // If the sorting column has * + } else { + for(int i = 0; i < incoming.getSchema().getFieldCount(); ++i) { + Ordering expandOrdering = new Ordering(incoming.getSchema().getColumn(i).getPath(), + direction.shortString, + nullDirection.name()); + orderings.add(expandOrdering); + } + } + } else { + orderings.add(ordering); + } + } + + return orderings; + } } diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestDistinctStar.java b/exec/java-exec/src/test/java/org/apache/drill/TestDistinctStar.java new file mode 100644 index 00000000000..4b96b983181 --- /dev/null +++ b/exec/java-exec/src/test/java/org/apache/drill/TestDistinctStar.java @@ -0,0 +1,167 @@ +/** + * 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.types.TypeProtos; +import org.apache.drill.common.util.FileUtils; +import org.junit.Test; + +public class TestDistinctStar extends BaseTestQuery { + @Test // DRILL-2139 + public void testSelectDistinctByStreamAgg() throws Exception { + test("alter session set `planner.enable_hashagg` = false;"); + test("alter session set `planner.enable_streamagg` = true;"); + + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + String query = String.format("select distinct *, a1, *, b1, *, c1, * \n" + + "from dfs.`%s`", root); + + testBuilder() + .sqlQuery(query) + .unOrdered() + .csvBaselineFile("testframework/testDistinctStar/testSelectDistinct.tsv") + .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, + TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR) + .baselineColumns("a1", "b1", "c1", "a10", + "a11", "b10", "c10", "b11", + "a12", "b12", "c11", "c12", + "a13", "b13", "c13") + .build() + .run(); + + test("alter session set `planner.enable_hashagg` = true;"); + } + + @Test // see DRILL-2139 + public void testSelectDistinctByHashAgg() throws Exception { + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + test("alter session set `planner.enable_hashagg` = true;"); + test("alter session set `planner.enable_streamagg` = false;"); + + String query = String.format("select distinct *, a1, *, b1, *, c1, * \n" + + "from dfs.`%s`", root); + + testBuilder() + .sqlQuery(query) + .unOrdered() + .csvBaselineFile("testframework/testDistinctStar/testSelectDistinct.tsv") + .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, + TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.VARCHAR, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR) + .baselineColumns("a1", "b1", "c1", "a10", + "a11", "b10", "c10", "b11", + "a12", "b12", "c11", "c12", + "a13", "b13", "c13") + .build() + .run(); + + test("alter session set `planner.enable_streamagg` = true;"); + } + + @Test // DRILL-2139 + public void testSelectDistinctOverJoin() throws Exception { + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + String query = String.format("select distinct * \n" + + "from dfs.`%s` t1, dfs.`%s` t2 " + + "where (t1.a1 = t2.a1)", root, root); + + testBuilder() + .sqlQuery(query) + .unOrdered() + .csvBaselineFile("testframework/testDistinctStar/testSelectDistinctOverJoin.tsv") + .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR, + TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.VARCHAR) + .baselineColumns("a1", "b1", "c1", "a10", "b10", "c10") + .build() + .run(); + } + + @Test // DRILL-2139 + public void testSelectDistinctExpression() throws Exception { + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + String query = String.format("select distinct *, a1 + 3 as expr \n" + + "from dfs.`%s`", root); + testBuilder() + .sqlQuery(query) + .unOrdered() + .csvBaselineFile("testframework/testDistinctStar/testSelectDistinctExpression.tsv") + .baselineTypes(TypeProtos.MinorType.BIGINT, TypeProtos.MinorType.BIGINT, + TypeProtos.MinorType.VARCHAR, TypeProtos.MinorType.BIGINT) + .baselineColumns("a1", "b1", "c1", "expr") + .build() + .run(); + } + + @Test // DRILL-2139 + public void testSelectDistinctViewHashAgg() throws Exception { + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + String createView = String.format("create view nation_view_testSelectDistinctView as \n" + + "select a1, b1 from dfs_test.`%s`", root); + String query = "select distinct * from nation_view_testSelectDistinctView"; + try { + test("use dfs_test.tmp"); + test(createView); + test("alter session set `planner.enable_streamagg` = false"); + testBuilder() + .sqlQuery(query) + .unOrdered() + .baselineColumns("a1", "b1") + .baselineValues(0l, 1l) + .baselineValues(0l, 2l) + .baselineValues(1l, 1l) + .baselineValues(1l, 2l) + .build() + .run(); + } finally { + test("drop view nation_view_testSelectDistinctView"); + test("alter session set `planner.enable_streamagg` = true"); + } + } + + @Test // DRILL-2139 + public void testSelectDistinctViewStreamAgg() throws Exception { + String root = FileUtils.getResourceAsFile("/store/text/data/repeatedRows.json").toURI().toString(); + String createView = String.format("create view nation_view_testSelectDistinctView as \n" + + "select a1, b1 from dfs_test.`%s`", root); + String query = "select distinct * from nation_view_testSelectDistinctView"; + try { + test("use dfs_test.tmp"); + test(createView); + test("alter session set `planner.enable_hashagg` = false"); + testBuilder() + .sqlQuery(query) + .unOrdered() + .baselineColumns("a1", "b1") + .baselineValues(0l, 1l) + .baselineValues(0l, 2l) + .baselineValues(1l, 1l) + .baselineValues(1l, 2l) + .build() + .run(); + } finally { + test("drop view nation_view_testSelectDistinctView"); + test("alter session set `planner.enable_hashagg` = true"); + } + } +} diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java index 3786bfdebd6..a1e9115506a 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java @@ -19,12 +19,13 @@ package org.apache.drill.exec.physical.impl.agg; import org.apache.drill.BaseTestQuery; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.util.FileUtils; import org.junit.Ignore; import org.junit.Test; public class TestHashAggr extends BaseTestQuery{ - @Test public void testQ6() throws Exception{ testPhysicalFromFile("agg/hashagg/q6.json"); diff --git a/exec/java-exec/src/test/resources/store/text/data/repeatedRows.json b/exec/java-exec/src/test/resources/store/text/data/repeatedRows.json new file mode 100644 index 00000000000..119f0f0a4ae --- /dev/null +++ b/exec/java-exec/src/test/resources/store/text/data/repeatedRows.json @@ -0,0 +1,10 @@ +{ "a1": 0, "b1": 1, "c1": "a"} +{ "a1": 0, "b1": 1, "c1": "a"} +{ "a1": 0, "b1": 2, "c1": "a"} +{ "a1": 0, "b1": 2, "c1": "a"} +{ "a1": 0, "b1": 1, "c1": "a"} +{ "a1": 1, "b1": 1, "c1": "a"} +{ "a1": 1, "b1": 2, "c1": "a"} +{ "a1": 1, "b1": 2, "c1": "a"} +{ "a1": 1, "b1": 2, "c1": "b"} +{ "a1": 1, "b1": 2, "c1": "b"} \ No newline at end of file diff --git a/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinct.tsv b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinct.tsv new file mode 100644 index 00000000000..53ae4b4ac08 --- /dev/null +++ b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinct.tsv @@ -0,0 +1,5 @@ +0 1 a 0 0 1 a 1 0 1 a a 0 1 a +0 2 a 0 0 2 a 2 0 2 a a 0 2 a +1 1 a 1 1 1 a 1 1 1 a a 1 1 a +1 2 a 1 1 2 a 2 1 2 a a 1 2 a +1 2 b 1 1 2 b 2 1 2 b b 1 2 b \ No newline at end of file diff --git a/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctExpression.tsv b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctExpression.tsv new file mode 100644 index 00000000000..09c00a66c56 --- /dev/null +++ b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctExpression.tsv @@ -0,0 +1,5 @@ +0 1 a 3 +0 2 a 3 +1 1 a 4 +1 2 a 4 +1 2 b 4 \ No newline at end of file diff --git a/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctOverJoin.tsv b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctOverJoin.tsv new file mode 100644 index 00000000000..0b2f8f093b5 --- /dev/null +++ b/exec/java-exec/src/test/resources/testframework/testDistinctStar/testSelectDistinctOverJoin.tsv @@ -0,0 +1,13 @@ +0 1 a 0 1 a +0 2 a 0 1 a +0 1 a 0 2 a +0 2 a 0 2 a +1 1 a 1 1 a +1 2 b 1 1 a +1 2 a 1 1 a +1 1 a 1 2 a +1 2 b 1 2 a +1 2 a 1 2 a +1 1 a 1 2 b +1 2 b 1 2 b +1 2 a 1 2 b \ No newline at end of file