You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/02/16 17:08:02 UTC

[GitHub] [spark] peter-toth commented on a change in pull request #31573: [SPARK-34444][SQL] Pushdown scalar-subquery filter to FileSourceScan

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org