[SPARK-35244][SQL][FOLLOWUP] Add null check for the exception cause
### What changes were proposed in this pull request? Make sure we re-throw an exception that is not null. ### Why are the changes needed? to be super safe ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? N/A Closes #32387 from cloud-fan/minor. Authored-by: Wenchen Fan <wenchen@databricks.com> Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
This commit is contained in:
parent
86d3bb5f7d
commit
403e4795e9
|
@ -134,7 +134,8 @@ trait InvokeLike extends Expression with NonSQLExpression {
|
||||||
method.invoke(obj, args: _*)
|
method.invoke(obj, args: _*)
|
||||||
} catch {
|
} catch {
|
||||||
// Re-throw the original exception.
|
// Re-throw the original exception.
|
||||||
case e: java.lang.reflect.InvocationTargetException => throw e.getCause
|
case e: java.lang.reflect.InvocationTargetException if e.getCause != null =>
|
||||||
|
throw e.getCause
|
||||||
}
|
}
|
||||||
val boxedClass = ScalaReflection.typeBoxedJavaMapping.get(dataType)
|
val boxedClass = ScalaReflection.typeBoxedJavaMapping.get(dataType)
|
||||||
if (boxedClass.isDefined) {
|
if (boxedClass.isDefined) {
|
||||||
|
|
Loading…
Reference in a new issue