sigmod commented on a change in pull request #32060:
URL: https://github.com/apache/spark/pull/32060#discussion_r608420094



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala
##########
@@ -77,8 +80,54 @@ object CurrentOrigin {
 // A tag of a `TreeNode`, which defines name and type
 case class TreeNodeTag[T](name: String)
 
+// A wrapper of Bitset for pattern enums.
+trait TreePatternBits {
+  val treePatternBits: BitSet
+
+  /**
+   * @param t, the tree pattern enum to be tested.
+   * @return true if the bit for `t` is set; false otherwise.
+   */
+  @inline final def containsPattern(t: TreePattern): Boolean = {
+    treePatternBits.get(t.id)
+  }
+
+  /**
+   * @param patterns, a sequence of tree pattern enums to be tested.
+   * @return true if every bit for `patterns` is set; false otherwise.
+   */
+  final def containsAllPatterns(patterns: TreePattern*): Boolean = {
+    val iterator = patterns.iterator

Review comment:
       containsPattern family will be frequently called.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to