Skip to content
Snippets Groups Projects
Commit 4f75f785 authored by gatorsmile's avatar gatorsmile Committed by Reynold Xin
Browse files

[SPARK-12564][SQL] Improve missing column AnalysisException

```
org.apache.spark.sql.AnalysisException: cannot resolve 'value' given input columns text;
```

lets put a `:` after `columns` and put the columns in `[]` so that they match the toString of DataFrame.

Author: gatorsmile <gatorsmile@gmail.com>

Closes #10518 from gatorsmile/improveAnalysisExceptionMsg.
parent 7ab0e228
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ trait CheckAnalysis {
operator transformExpressionsUp {
case a: Attribute if !a.resolved =>
val from = operator.inputSet.map(_.name).mkString(", ")
a.failAnalysis(s"cannot resolve '${a.prettyString}' given input columns $from")
a.failAnalysis(s"cannot resolve '${a.prettyString}' given input columns: [$from]")
case e: Expression if e.checkInputDataTypes().isFailure =>
e.checkInputDataTypes() match {
......
......@@ -514,7 +514,7 @@ class DatasetSuite extends QueryTest with SharedSQLContext {
val e = intercept[AnalysisException] {
ds.as[ClassData2].collect()
}
assert(e.getMessage.contains("cannot resolve 'c' given input columns a, b"), e.getMessage)
assert(e.getMessage.contains("cannot resolve 'c' given input columns: [a, b]"), e.getMessage)
}
test("runtime nullability check") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment