File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments