diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java index 8d2f1103922b..9a4abf5b226a 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java @@ -132,6 +132,7 @@ public class CalciteRulesManager CoreRules.FILTER_VALUES_MERGE, CoreRules.PROJECT_FILTER_VALUES_MERGE, CoreRules.PROJECT_VALUES_MERGE, + CoreRules.SORT_PROJECT_TRANSPOSE, CoreRules.AGGREGATE_VALUES ); diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java index 2d6dc078b9a6..31107e407c2f 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java @@ -2739,7 +2739,6 @@ public void testGroupByWithSelectAndOrderByProjections() ); } - @DecoupledIgnore(mode = Modes.PLAN_MISMATCH) @Test public void testTopNWithSelectProjections() { @@ -2756,7 +2755,7 @@ public void testTopNWithSelectProjections() .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .dimension(new DefaultDimensionSpec("dim1", "d0")) - .postAggregators(expressionPostAgg("p0", "substring(\"d0\", 1, -1)")) + .postAggregators(expressionPostAgg("s0", "substring(\"d0\", 1, -1)")) .metric(new DimensionTopNMetricSpec(null, StringComparators.LEXICOGRAPHIC)) .threshold(10) .context(QUERY_CONTEXT_DEFAULT) @@ -11643,7 +11642,6 @@ public void testSortProjectAfterNestedGroupBy() ); } - @DecoupledIgnore(mode = Modes.CANNOT_CONVERT) @Test public void testPostAggWithTimeseries() { @@ -11674,7 +11672,7 @@ public void testPostAggWithTimeseries() ) ) .postAggregators( - expressionPostAgg("p0", "(\"a0\" + \"a1\")") + expressionPostAgg("s0", "(\"a0\" + \"a1\")") ) .descending(true) .context(getTimeseriesContextWithFloorTime(TIMESERIES_CONTEXT_BY_GRAN, "d0")) @@ -11687,7 +11685,6 @@ public void testPostAggWithTimeseries() ); } - @DecoupledIgnore(mode = Modes.PLAN_MISMATCH) @Test public void testPostAggWithTopN() { @@ -11736,7 +11733,7 @@ public void testPostAggWithTopN() new FieldAccessPostAggregator(null, "a0:count") ) ), - expressionPostAgg("p0", "(\"a1\" + \"a2\")") + expressionPostAgg("s0", "(\"a1\" + \"a2\")") ) .metric(new DimensionTopNMetricSpec(null, StringComparators.NUMERIC)) .threshold(5)