xuyangzhong commented on code in PR #24239:
URL: https://github.com/apache/flink/pull/24239#discussion_r1472815464
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/optimize/ClearQueryBlockAliasResolver.java:
##########
@@ -31,22 +31,19 @@
import java.util.stream.Collectors;
/** A shuttle to remove query block alias hint. */
-public class ClearQueryBlockAliasResolver extends RelShuttleImpl {
+public class ClearQueryBlockAliasResolver extends RelHomogeneousShuttle {
public List<RelNode> resolve(List<RelNode> roots) {
return roots.stream().map(node ->
node.accept(this)).collect(Collectors.toList());
}
@Override
- protected RelNode visitChild(RelNode parent, int i, RelNode child) {
- RelNode newParent = clearQueryBlockAlias(parent);
- return super.visitChild(newParent, i, child);
- }
-
- @Override
- public RelNode visit(TableScan scan) {
- RelNode newScan = clearQueryBlockAlias(scan);
- return super.visit(newScan);
+ public RelNode visit(RelNode other) {
+ if (FlinkRelOptUtil.containsSubQuery(other)) {
+ other = FlinkHints.resolveSubQuery(other, relNode ->
relNode.accept(this));
+ }
+ RelNode result = clearQueryBlockAlias(other);
Review Comment:
Because I want let `clearQueryBlockAlias` have a single responsibility, that
is, given a RelNode and try to clear unreasonable hints on this relnode.
`ClearQueryBlockAliasResolver` itself is responsible for traversing all nodes.
WDYT?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]