Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ object FunctionRegistry {
// If there is an apply method that accepts Seq[Expression], use that one.
Try(varargCtor.get.newInstance(expressions).asInstanceOf[Expression]) match {
case Success(e) => e
case Failure(e) => throw new AnalysisException(e.getMessage)
case Failure(e) =>
// the exception is an invocation exception. To get a meaningful message, we need the
// cause.
throw new AnalysisException(e.getCause.getMessage)
}
} else {
// Otherwise, find a constructor method that matches the number of arguments, and use that.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Argument number exception
select concat_ws();
select format_string();
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 2


-- !query 0
select concat_ws()
-- !query 0 schema
struct<>
-- !query 0 output
org.apache.spark.sql.AnalysisException
requirement failed: concat_ws requires at least one argument.; line 1 pos 7


-- !query 1
select format_string()
-- !query 1 schema
struct<>
-- !query 1 output
org.apache.spark.sql.AnalysisException
requirement failed: format_string() should take at least 1 argument; line 1 pos 7