File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -439,8 +439,10 @@ case class MapObjects(
439439 s " boolean ${loopVar.isNull} = ${genInputData.isNull} || ${loopVar.value} == null; "
440440 }
441441
442- val isGenFunctionReturnOption = lambdaFunction.dataType match {
443- case ObjectType (cls) if cls == classOf [Option [_]] => " true"
442+ // If lambdaFunction is WrapOption, we will not determine null or not based on the
443+ // value of loopVar.isNull, because WrapOption will return None for null.
444+ val isWrapOption = lambdaFunction match {
445+ case _ : WrapOption => " true"
444446 case _ => " false"
445447 }
446448
@@ -461,7 +463,7 @@ case class MapObjects(
461463 ( $elementJavaType) ${genInputData.value}${itemAccessor(loopIndex)};
462464 $loopNullCheck
463465
464- if ( ${loopVar.isNull} && ! ${isGenFunctionReturnOption }) {
466+ if ( ${loopVar.isNull} && ! ${isWrapOption }) {
465467 $convertedArray[ $loopIndex] = null;
466468 } else {
467469 ${genFunction.code}
You can’t perform that action at this time.
0 commit comments