francis0407 commented on a change in pull request #23783: [SPARK-26854][SQL]
Support ANY/SOME subquery
URL: https://github.com/apache/spark/pull/23783#discussion_r261900736
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
##########
@@ -199,10 +207,52 @@ case class InSubquery(values: Seq[Expression], query:
ListQuery)
override def children: Seq[Expression] = values :+ query
override def nullable: Boolean = children.exists(_.nullable)
override def foldable: Boolean = children.forall(_.foldable)
- override def toString: String = s"$value IN ($query)"
- override def sql: String = s"(${value.sql} IN (${query.sql}))"
+
+ private def toString(left: String, right: String): String = {
+ s"$left $symbol ($right)"
+ }
+
+ override def toString: String = toString(value.toString, query.toString)
+ override def sql: String = toString(value.sql, query.sql)
+}
+
+object PredicateSubquery {
+
+ def unapply(p: PredicateSubquery)
+ : Option[(Seq[Expression], ListQuery, (Expression, Expression) =>
Expression)] = {
Review comment:
Databricks Scala guide gives an example:
``` scala
def newAPIHadoopFile[K, V, F <: NewInputFormat[K, V]](
path: String,
fClass: Class[F],
kClass: Class[K],
vClass: Class[V],
conf: Configuration = hadoopConfiguration)
: RDD[(K, V)] = {
// method body
}
```
Therefore this should start a new line with 2 spaces indent.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]