peter-toth commented on a change in pull request #31573:
URL: https://github.com/apache/spark/pull/31573#discussion_r576989349



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/subquery.scala
##########
@@ -85,6 +85,26 @@ object SubqueryExpression {
     }.isDefined
   }
 
+  /**
+   * Returns true when an expression contains a scalar subquery
+   */
+  def hasScalarSubquery(e: Expression): Boolean = {
+    e.find {
+      case _: ScalarSubquery => true
+      case _ => false
+    }.isDefined
+  }
+
+  /**
+   * Returns true when an expression contains a non-scalar subquery
+   */
+  def hasNonScalarSubquery(e: Expression): Boolean = {
+    e.find {
+      case s: SubqueryExpression if !hasScalarSubquery(s) => true

Review comment:
       how about `case s: SubqueryExpression => 
!s.isInstanceOf[ScalarSubquery]` and we probably don't need `def 
hasScalarSubquery()` at all?




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