danny0405 commented on a change in pull request #13577:
URL: https://github.com/apache/flink/pull/13577#discussion_r505288730



##########
File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/utils/FlinkRexUtil.scala
##########
@@ -343,6 +344,54 @@ object FlinkRexUtil {
       }
     })
 
+  /**
+   * Returns whether a given tree contains any {@link RexInputRef} nodes
+   * with given indices.
+   *
+   * @param node a RexNode tree
+   */
+  def containsInputRef(node: RexNode, refs: JSet[Integer]): Boolean = try {
+    val visitor = new RexVisitorImpl[Void](true) {
+      override def visitInputRef(inputRef: RexInputRef): Void = {
+        if (refs.contains(inputRef.getIndex)) {
+          throw new Util.FoundOne(inputRef)
+        }
+        null
+      }
+    }
+    node.accept(visitor)
+    false
+  } catch {
+    case e: Util.FoundOne =>
+      Util.swallow(e, null)
+      true
+  }

Review comment:
       It is used by the following PR, i can remove it now ~




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to