[SPARK-36789][SQL] Use the correct constant type as the null value holder in array functions
### What changes were proposed in this pull request?
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.
### Why are the changes needed?
Fix a potential bug. Somehow we can hit this bug sometimes after https://github.com/apache/spark/pull/33955 .
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
existing tests
Closes #34029 from cloud-fan/minor.
Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 4145498826
)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
This commit is contained in:
parent
7d7c9915bb
commit
16215755b7
|
@ -3336,7 +3336,9 @@ trait ArraySetLike {
|
|||
@transient protected lazy val nullValueHolder = et match {
|
||||
case ByteType => "(byte) 0"
|
||||
case ShortType => "(short) 0"
|
||||
case LongType => "(long) 0"
|
||||
case LongType => "0L"
|
||||
case FloatType => "0.0f"
|
||||
case DoubleType => "0.0"
|
||||
case _ => "0"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue