Skip to content

Commit 0679728

Browse files
authored
Make column-prune not effective for InformationSchemaTableScanNode
1 parent 90e7a80 commit 0679728

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/iterative/rule/PruneTableScanColumns.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,10 @@ public static Optional<PlanNode> pruneColumns(TableScanNode node, Set<Symbol> re
102102
deviceTableScanNode.getPushDownOffset(),
103103
deviceTableScanNode.isPushLimitToEachDevice()));
104104
} else if (node instanceof InformationSchemaTableScanNode) {
105-
return Optional.of(
106-
new InformationSchemaTableScanNode(
107-
node.getPlanNodeId(),
108-
node.getQualifiedObjectName(),
109-
newOutputs,
110-
newAssignments,
111-
node.getPushDownPredicate(),
112-
node.getPushDownLimit(),
113-
node.getPushDownOffset()));
105+
// For the convenience of process in execution stage, column-prune for
106+
// InformationSchemaTableScanNode is
107+
// not supported now.
108+
return Optional.empty();
114109
} else {
115110
throw new UnsupportedOperationException(
116111
"Unknown TableScanNode type: " + node.getClass().getSimpleName());

iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/ShowQueriesTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.mergeSort;
4141
import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.offset;
4242
import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.output;
43+
import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.project;
4344
import static org.apache.iotdb.db.queryengine.plan.relational.planner.assertions.PlanMatchPattern.sort;
4445

4546
public class ShowQueriesTest {
@@ -118,4 +119,24 @@ public void testSort() {
118119
planTester.getFragmentPlan(2),
119120
sort(infoSchemaTableScan("information_schema.queries", Optional.of(2))));
120121
}
122+
123+
@Test
124+
public void testNonSelectAll() {
125+
// Optimizer column-prune for InformationSchemaTableScanNode is not supported now.
126+
LogicalQueryPlan logicalQueryPlan =
127+
planTester.createPlan("select query_id from information_schema.queries");
128+
assertPlan(
129+
logicalQueryPlan,
130+
output(
131+
project(
132+
infoSchemaTableScan(
133+
"information_schema.queries",
134+
Optional.empty(),
135+
ImmutableList.of(
136+
QUERY_ID_TABLE_MODEL,
137+
START_TIME_TABLE_MODEL,
138+
DATA_NODE_ID_TABLE_MODEL,
139+
ELAPSED_TIME_TABLE_MODEL,
140+
STATEMENT.toLowerCase(Locale.ENGLISH))))));
141+
}
121142
}

0 commit comments

Comments
 (0)