Skip to content

Commit

Permalink
Make column-prune not effective for InformationSchemaTableScanNode
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei-hao-Li authored Dec 31, 2024
1 parent 90e7a80 commit 0679728
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,10 @@ public static Optional<PlanNode> pruneColumns(TableScanNode node, Set<Symbol> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))))));
}
}

0 comments on commit 0679728

Please sign in to comment.