diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableScanColumns.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableScanColumns.java index bd94b4489937..c9c577300e6c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableScanColumns.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableScanColumns.java @@ -102,15 +102,10 @@ public static Optional pruneColumns(TableScanNode node, Set re deviceTableScanNode.getPushDownOffset(), deviceTableScanNode.isPushLimitToEachDevice())); } else if (node instanceof InformationSchemaTableScanNode) { - return Optional.of( - new InformationSchemaTableScanNode( - node.getPlanNodeId(), - node.getQualifiedObjectName(), - newOutputs, - newAssignments, - node.getPushDownPredicate(), - node.getPushDownLimit(), - node.getPushDownOffset())); + // For the convenience of process in execution stage, column-prune for + // InformationSchemaTableScanNode is + // not supported now. + return Optional.empty(); } else { throw new UnsupportedOperationException( "Unknown TableScanNode type: " + node.getClass().getSimpleName()); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ShowQueriesTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ShowQueriesTest.java index e08cc5fae3e2..bdf44401aade 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ShowQueriesTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ShowQueriesTest.java @@ -40,6 +40,7 @@ import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.mergeSort; import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.offset; import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.output; +import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.project; import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.sort; public class ShowQueriesTest { @@ -118,4 +119,24 @@ public void testSort() { planTester.getFragmentPlan(2), sort(infoSchemaTableScan("information_schema.queries", Optional.of(2)))); } + + @Test + public void testNonSelectAll() { + // Optimizer column-prune for InformationSchemaTableScanNode is not supported now. + LogicalQueryPlan logicalQueryPlan = + planTester.createPlan("select query_id from information_schema.queries"); + assertPlan( + logicalQueryPlan, + output( + project( + infoSchemaTableScan( + "information_schema.queries", + Optional.empty(), + ImmutableList.of( + QUERY_ID_TABLE_MODEL, + START_TIME_TABLE_MODEL, + DATA_NODE_ID_TABLE_MODEL, + ELAPSED_TIME_TABLE_MODEL, + STATEMENT.toLowerCase(Locale.ENGLISH)))))); + } }