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_r260567442
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 ##########
 @@ -145,11 +145,19 @@ case class Not(child: Expression)
   override def sql: String = s"(NOT ${child.sql})"
 }
 
-/**
- * Evaluates to `true` if `values` are returned in `query`'s result set.
- */
-case class InSubquery(values: Seq[Expression], query: ListQuery)
-  extends Predicate with Unevaluable {
+abstract class PredicateSubquery extends Predicate with Unevaluable {
+
+  def values: Seq[Expression]
+  def query: ListQuery
+  def genCmp: (Expression, Expression) => Expression
+  def symbol: String
+
+  @transient protected lazy val cmpSymbol: String = genCmp(value, query) match 
{
+    case b: BinaryComparison =>
+      b.symbol
+    case _ @ Not(EqualTo(_, _)) =>
 
 Review comment:
   As we have discussed, `Not(AnySubquery(EqualTo))` is different from 
`AnySubquery(Not(EqualTo))`. We don't need to specially handle 
`Not(AnySubquery)`.
   We define `cmpSymbol` here, because we can't directly get the comparison 
symbol from an `Expression`. It is only called by `symbol`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]

Reply via email to