File tree Expand file tree Collapse file tree 1 file changed +7
-18
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -513,23 +513,11 @@ case class MapObjects private(
513
513
case _ => s " $loopIsNull = $loopValue == null; "
514
514
}
515
515
516
- val setValue = if (lambdaFunction.nullable) {
517
- s """
518
- if ( ${genFunction.isNull}) {
519
- $convertedArray[ $loopIndex] = null;
520
- } else {
521
- $convertedArray[ $loopIndex] = $genFunctionValue;
522
- }
523
- """
524
- } else {
525
- s " $convertedArray[ $loopIndex] = $genFunctionValue; "
526
- }
527
-
528
516
val code = s """
529
517
${genInputData.code}
530
518
${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
531
-
532
- if (! ${ genInputData.isNull} ) {
519
+ """ +
520
+ ctx.nullSafeExec(inputData.nullable, genInputData.isNull)( s """
533
521
$determineCollectionType
534
522
$convertedType[] $convertedArray = null;
535
523
int $dataLength = $getLength;
@@ -541,14 +529,15 @@ case class MapObjects private(
541
529
$loopNullCheck
542
530
543
531
${genFunction.code}
544
- $setValue
545
-
532
+ """ +
533
+ ctx.nullSafeExec(lambdaFunction.nullable, genFunction.isNull)(s """
534
+ $convertedArray[ $loopIndex] = $genFunctionValue;
535
+ """ ) + s """
546
536
$loopIndex += 1;
547
537
}
548
538
549
539
${ev.value} = new ${classOf [GenericArrayData ].getName}( $convertedArray);
550
- }
551
- """
540
+ """ )
552
541
ev.copy(code = code, isNull = genInputData.isNull)
553
542
}
554
543
}
You can’t perform that action at this time.
0 commit comments