Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[SPARK-28143][SQL]IN expression missing attribute should throw analys…
…is exception
  • Loading branch information
yaooqinn committed Jun 24, 2019
commit 4af96a1b90ceb54c64c798215d2f5eefe87ad896
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ object FunctionRegistry {
val params = Seq.fill(expressions.size)(classOf[Expression])
val f = constructors.find(_.getParameterTypes.toSeq == params).getOrElse {
val validParametersCount = constructors
.filter(_.getParameterTypes.forall(_ == classOf[Expression]))
.map(_.getParameterCount).distinct.sorted
val expectedNumberOfParameters = if (validParametersCount.length == 1) {
validParametersCount.head.toString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
checkKeywordsExist(sql("describe functioN abcadf"), "Function: abcadf not found.")
}

test("SPARK-28143: IN expression missing attribute should throw analysis exception") {
val query = "select 1 from where in ()"
val e = intercept[AnalysisException](sql(query))
assert(e.getMessage.startsWith("Invalid number of arguments for function in."))
}

test("SPARK-14415: All functions should have own descriptions") {
for (f <- spark.sessionState.functionRegistry.listFunction()) {
if (!Seq("cube", "grouping", "grouping_id", "rollup", "window").contains(f.unquotedString)) {
Expand Down