File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -637,13 +637,13 @@ object FunctionRegistry {
637637 .filter(_.getParameterTypes.head == classOf [String ])
638638 assert(constructors.length == 1 )
639639 val builder = (expressions : Seq [Expression ]) => {
640- assert(expressions.size == 1 ,
641- s " Invalid number of arguments for function $name. " +
640+ val params = classOf [String ] +: Seq .fill(expressions.size)(classOf [Expression ])
641+ val f = constructors.find(_.getParameterTypes.toSeq == params).getOrElse {
642+ throw new AnalysisException (s " Invalid number of arguments for function $name. " +
642643 s " Expected: 1; Found: ${expressions.size}" )
643- assert(expressions.head == classOf [Expression ],
644- s " Invalid arguments for function $name" )
644+ }
645645 try {
646- constructors.head. newInstance(name.toString, expressions.head ).asInstanceOf [Expression ]
646+ f. newInstance(name.toString +: expressions : _* ).asInstanceOf [Expression ]
647647 } catch {
648648 // the exception is an invocation exception. To get a meaningful message, we need the
649649 // cause.
You can’t perform that action at this time.
0 commit comments