Skip to content

Commit 8a97c30

Browse files
committed
xxx
1 parent 0ab9bd7 commit 8a97c30

File tree

1 file changed

+7
-6
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects

1 file changed

+7
-6
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ trait InvokeLike extends Expression with NonSQLExpression {
5252

5353
protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
5454
protected lazy val evaluatedArgs: Array[Object] = new Array[Object](arguments.length)
55+
private lazy val boxingFn: Any => Any =
56+
ScalaReflection.typeBoxedJavaMapping
57+
.get(dataType)
58+
.map(cls => v => cls.cast(v))
59+
.getOrElse(identity)
60+
5561

5662
/**
5763
* Prepares codes for arguments.
@@ -145,12 +151,7 @@ trait InvokeLike extends Expression with NonSQLExpression {
145151
case e: java.lang.reflect.InvocationTargetException if e.getCause != null =>
146152
throw e.getCause
147153
}
148-
val boxedClass = ScalaReflection.typeBoxedJavaMapping.get(dataType)
149-
if (boxedClass.isDefined) {
150-
boxedClass.get.cast(ret)
151-
} else {
152-
ret
153-
}
154+
boxingFn(ret)
154155
}
155156
}
156157

0 commit comments

Comments
 (0)