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

gurwls223 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 1b03949  [SPARK-36789][SQL] Use the correct constant type as the null 
value holder in array functions
1b03949 is described below

commit 1b0394996d4c9d833b208b0053cb0bbd6168b35b
Author: Wenchen Fan <[email protected]>
AuthorDate: Fri Sep 17 16:49:54 2021 +0900

    [SPARK-36789][SQL] Use the correct constant type as the null value holder 
in array functions
    
    In array functions, we use constant 0 as the placeholder when adding a null 
value to an array buffer. This PR makes sure the constant 0 matches the type of 
the array element.
    
    Fix a potential bug. Somehow we can hit this bug sometimes after 
https://github.com/apache/spark/pull/33955 .
    
    No
    
    existing tests
    
    Closes #34029 from cloud-fan/minor.
    
    Authored-by: Wenchen Fan <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
    (cherry picked from commit 4145498826f288e610b00033d9fc2063fd1acc9f)
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../apache/spark/sql/catalyst/expressions/collectionOperations.scala    | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
index f0f71fb..0c16865 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
@@ -3083,6 +3083,8 @@ trait ArraySetLike {
   @transient protected lazy val nullValueHolder = et match {
     case ByteType => "(byte) 0"
     case ShortType => "(short) 0"
+    case FloatType => "0.0f"
+    case DoubleType => "0.0"
     case _ => "0"
   }
 

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

Reply via email to