hvanhovell commented on code in PR #50470:
URL: https://github.com/apache/spark/pull/50470#discussion_r2032883883


##########
sql/api/src/main/scala/org/apache/spark/sql/internal/columnNodes.scala:
##########
@@ -651,3 +652,24 @@ private[sql] case class LazyExpression(
   override def sql: String = "lazy" + argumentsToSql(Seq(child))
   override private[internal] def children: Seq[ColumnNodeLike] = Seq(child)
 }
+
+sealed trait SubqueryType
+
+object SubqueryType {
+  case object SCALAR extends SubqueryType
+  case object EXISTS extends SubqueryType
+  case class IN(values: Seq[ColumnNode]) extends SubqueryType
+}
+
+case class SubqueryExpression(
+    ds: Dataset[_],
+    subqueryType: SubqueryType,
+    override val origin: Origin = CurrentOrigin.get)
+    extends ColumnNode {
+  override def sql: String = subqueryType match {
+    case SubqueryType.SCALAR => s"($ds)"
+    case SubqueryType.IN(values) => s"(${values.map(_.sql).mkString(",")}) 
$subqueryType ($ds)"

Review Comment:
   Use `IN` explicitly? 



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to