jinxing64 commented on a change in pull request #1936:
URL: https://github.com/apache/calcite/pull/1936#discussion_r412644512
##########
File path:
core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
##########
@@ -192,6 +195,8 @@
// Push filters to the bottom, and combine projects on top.
RelNode target = materialization.queryRel;
+ // try to trim unused field in relational expressions.
+ root = trimUnusedfields(root);
Review comment:
Shall we also do trimming on `target` for canonicalization ?
##########
File path:
core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
##########
@@ -223,6 +228,19 @@
return new SubstitutionVisitor(target, root).go(materialization.tableRel);
}
+ /**
+ * trim unused fields in relational expressions.
+ */
+ private static RelNode trimUnusedfields(RelNode relNode) {
+ final List<RelOptTable> relOptTables = RelOptUtil.findAllTables(relNode);
Review comment:
What if there's no `TableScan` in the tree of `relNode` ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]