From afb3d917772123ccc4ee46ac8bdb06b9ab00cdf3 Mon Sep 17 00:00:00 2001 From: Adarsh Sanjeev Date: Thu, 12 Jan 2023 15:25:01 +0530 Subject: [PATCH] Add unit test for complex column grouping (#13650) * Add unit test for complex column grouping Co-authored-by: Karan Kumar --- .../org/apache/druid/msq/exec/MSQSelectTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQSelectTest.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQSelectTest.java index 5c45fbcdf6a..d56afd77468 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQSelectTest.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQSelectTest.java @@ -62,6 +62,7 @@ import org.apache.druid.sql.SqlPlanningException; import org.apache.druid.sql.calcite.expression.DruidExpression; import org.apache.druid.sql.calcite.external.ExternalDataSource; import org.apache.druid.sql.calcite.filtration.Filtration; +import org.apache.druid.sql.calcite.planner.UnsupportedSQLQueryException; import org.apache.druid.sql.calcite.util.CalciteTests; import org.hamcrest.CoreMatchers; import org.junit.Test; @@ -1206,6 +1207,20 @@ public class MSQSelectTest extends MSQTestBase .verifyExecutionError(); } + @Test + public void testGroupByWithComplexColumnThrowsUnsupportedException() + { + testSelectQuery() + .setSql("select unique_dim1 from foo2 group by unique_dim1") + .setQueryContext(context) + .setExpectedExecutionErrorMatcher(CoreMatchers.allOf( + CoreMatchers.instanceOf(UnsupportedSQLQueryException.class), + ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString( + "SQL requires a group-by on a column of type COMPLEX that is unsupported")) + )) + .verifyExecutionError(); + } + @Test public void testGroupByMultiValueMeasureQuery() {