diff options
author | gatorsmile <gatorsmile@gmail.com> | 2015-12-29 22:28:59 -0800 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-12-29 22:28:59 -0800 |
commit | 4f75f785df0e59ca5ae48e86f3dfc00b45d96b18 (patch) | |
tree | ccf3494146c03662ad5db5ef2e92ffd0091cb90e /sql | |
parent | 7ab0e2289df39eed03b0b8c8b2b350faf2b4e4ee (diff) | |
download | spark-4f75f785df0e59ca5ae48e86f3dfc00b45d96b18.tar.gz spark-4f75f785df0e59ca5ae48e86f3dfc00b45d96b18.tar.bz2 spark-4f75f785df0e59ca5ae48e86f3dfc00b45d96b18.zip |
[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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala | 2 | ||||
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala index 440f679913..a1be1473cc 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala @@ -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 { diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala index 7fe66e461c..c19b5a4d98 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala @@ -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") { |