This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 7686d7f  [SPARK-31563][SQL][FOLLOWUP] Create literals directly from 
Catalyst's internal value in InSet.sql
7686d7f is described below

commit 7686d7f3ee340537ddcf31596755acd010f9b56f
Author: Max Gekk <[email protected]>
AuthorDate: Wed Apr 29 06:44:22 2020 +0000

    [SPARK-31563][SQL][FOLLOWUP] Create literals directly from Catalyst's 
internal value in InSet.sql
    
    ### What changes were proposed in this pull request?
    In the PR, I propose to simplify the code of `InSet.sql` and create 
`Literal` instances directly from Catalyst's internal values by using the 
default `Literal` constructor.
    
    ### Why are the changes needed?
    This simplifies code and avoids unnecessary conversions to external types.
    
    ### Does this PR introduce any user-facing change?
    No
    
    ### How was this patch tested?
    By existing test `SPARK-31563: sql of InSet for UTF8String collection` in 
`ColumnExpressionSuite`.
    
    Closes #28399 from MaxGekk/fix-InSet-sql-followup.
    
    Authored-by: Max Gekk <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
    (cherry picked from commit 86761861c28e1c854b4f78f1c078591b11b7daf3)
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../scala/org/apache/spark/sql/catalyst/expressions/predicates.scala    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
index ac492cf..2c4f41f 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
@@ -521,7 +521,7 @@ case class InSet(child: Expression, hset: Set[Any]) extends 
UnaryExpression with
   override def sql: String = {
     val valueSQL = child.sql
     val listSQL = hset.toSeq
-      .map(elem => Literal(convertToScala(elem, child.dataType)).sql)
+      .map(elem => Literal(elem, child.dataType).sql)
       .mkString(", ")
     s"($valueSQL IN ($listSQL))"
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to