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(
513513 case _ => s " $loopIsNull = $loopValue == null; "
514514 }
515515
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-
528516 val code = s """
529517 ${genInputData.code}
530518 ${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
531-
532- if (! ${ genInputData.isNull} ) {
519+ """ +
520+ ctx.nullSafeExec(inputData.nullable, genInputData.isNull)( s """
533521 $determineCollectionType
534522 $convertedType[] $convertedArray = null;
535523 int $dataLength = $getLength;
@@ -541,14 +529,15 @@ case class MapObjects private(
541529 $loopNullCheck
542530
543531 ${genFunction.code}
544- $setValue
545-
532+ """ +
533+ ctx.nullSafeExec(lambdaFunction.nullable, genFunction.isNull)(s """
534+ $convertedArray[ $loopIndex] = $genFunctionValue;
535+ """ ) + s """
546536 $loopIndex += 1;
547537 }
548538
549539 ${ev.value} = new ${classOf [GenericArrayData ].getName}( $convertedArray);
550- }
551- """
540+ """ )
552541 ev.copy(code = code, isNull = genInputData.isNull)
553542 }
554543}
You can’t perform that action at this time.
0 commit comments