diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRelFieldTrimmer.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRelFieldTrimmer.java index 0adb93698d7..9a3673c6256 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRelFieldTrimmer.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRelFieldTrimmer.java @@ -50,6 +50,11 @@ import java.util.Collections; import java.util.List; import java.util.Set; +/** + * DruidRelFieldTrimmer is a subclass of RelFieldTrimmer that provides additional support for Druid specific RelNodes. + * + * It is used to trim fields from Druid specific RelNodes like LogicalUnnest. + */ public class DruidRelFieldTrimmer extends RelFieldTrimmer { private final RelBuilder relBuilder; 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 e280535f04a..55e6da38762 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 @@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.logical.LogicalCorrelate; import org.apache.calcite.runtime.CalciteContextException; import org.apache.druid.common.config.NullHandling; import org.apache.druid.error.DruidException; @@ -41,7 +42,6 @@ import org.apache.druid.math.expr.ExprEval; import org.apache.druid.math.expr.ExprMacroTable; import org.apache.druid.query.Druids; import org.apache.druid.query.InlineDataSource; -import org.apache.druid.query.JoinAlgorithm; import org.apache.druid.query.JoinDataSource; import org.apache.druid.query.LookupDataSource; import org.apache.druid.query.OperatorFactoryBuilders; @@ -15894,6 +15894,17 @@ public class CalciteQueryTest extends BaseCalciteQueryTest assertThat(e, invalidSqlContains("DISTINCT is not supported for window functions")); } + @Test + public void testRelFieldTrimmerUpgrade() + { + assertEquals( + "1.37.0", + RelNode.class.getPackage().getImplementationVersion(), + "Calcite version changed; check if DruidRelFieldTrimmer#trimFields(LogicalCorrelate correlate,...) is still needed or not!" + ); + } + + @Test public void testUnSupportedAggInSelectWindow() {