Skip to content

Commit 9fc152c

Browse files
committed
Use getMethod.
1 parent 3829aaa commit 9fc152c

File tree

1 file changed

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

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,11 @@ case class Invoke(
325325

326326
@transient lazy val method = targetObject.dataType match {
327327
case ObjectType(cls) =>
328-
val m = cls.getMethods.find { m =>
329-
m.getName == encodedFunctionName && m.getParameterCount == arguments.length
330-
}
331-
if (m.isEmpty) {
332-
sys.error(s"Couldn't find $encodedFunctionName on $cls")
333-
} else {
334-
m
328+
try {
329+
Some(cls.getMethod(encodedFunctionName, argClasses: _*))
330+
} catch {
331+
case _: NoSuchMethodException =>
332+
sys.error(s"Couldn't find $encodedFunctionName on $cls")
335333
}
336334
case _ => None
337335
}

0 commit comments

Comments
 (0)