HyukjinKwon commented on a change in pull request #24947: [SPARK-28143][SQL]
Expressions without proper constructors should throw AnalysisException
URL: https://github.com/apache/spark/pull/24947#discussion_r307588700
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
##########
@@ -583,7 +583,9 @@ object FunctionRegistry {
val validParametersCount = constructors
.filter(_.getParameterTypes.forall(_ == classOf[Expression]))
.map(_.getParameterCount).distinct.sorted
- val expectedNumberOfParameters = if (validParametersCount.length ==
1) {
+ val expectedNumberOfParameters = if (validParametersCount.isEmpty) {
+
constructors.headOption.map(_.getParameterCount).getOrElse(0).toString
Review comment:
The problem is that we have function registered `in` but that's unable/not
supposed to to call via `in(...)`. Possibly there might be more cases like
this. Ideally we might have to identify and remove those expressions out but
wanted to narrow the scope this PR by such change.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]