diff options
author | Michael Armbrust <michael@databricks.com> | 2015-05-22 17:23:12 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-05-22 17:23:12 -0700 |
commit | 3c1305107a2d6d2de862e8b41dbad0e85585b1ef (patch) | |
tree | 1f8e28e34f7acf660df84d50378a6fe65d261fb6 /sql/catalyst | |
parent | 821254fb945c3e19540eb57fff1f656737ef484b (diff) | |
download | spark-3c1305107a2d6d2de862e8b41dbad0e85585b1ef.tar.gz spark-3c1305107a2d6d2de862e8b41dbad0e85585b1ef.tar.bz2 spark-3c1305107a2d6d2de862e8b41dbad0e85585b1ef.zip |
[SPARK-7834] [SQL] Better window error messages
Author: Michael Armbrust <michael@databricks.com>
Closes #6363 from marmbrus/windowErrors and squashes the following commits:
516b02d [Michael Armbrust] [SPARK-7834] [SQL] Better window error messages
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala | 5 | ||||
-rw-r--r-- | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala | 13 |
2 files changed, 18 insertions, 0 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 06a0504359..193dc6b654 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 @@ -71,6 +71,11 @@ trait CheckAnalysis { s"invalid expression ${b.prettyString} " + s"between ${b.left.dataType.simpleString} and ${b.right.dataType.simpleString}") + case WindowExpression(UnresolvedWindowFunction(name, _), _) => + failAnalysis( + s"Could not resolve window function '$name'. " + + "Note that, using window functions currently requires a HiveContext") + case w @ WindowExpression(windowFunction, windowSpec) if windowSpec.validate.nonEmpty => // The window spec is not valid. val reason = windowSpec.validate.get diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala index e1d6ac462f..939cefb71b 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala @@ -167,6 +167,19 @@ class AnalysisSuite extends FunSuite with BeforeAndAfter { } errorTest( + "unresolved window function", + testRelation2.select( + WindowExpression( + UnresolvedWindowFunction( + "lead", + UnresolvedAttribute("c") :: Nil), + WindowSpecDefinition( + UnresolvedAttribute("a") :: Nil, + SortOrder(UnresolvedAttribute("b"), Ascending) :: Nil, + UnspecifiedFrame)).as('window)), + "lead" :: "window functions currently requires a HiveContext" :: Nil) + + errorTest( "too many generators", listRelation.select(Explode('list).as('a), Explode('list).as('b)), "only one generator" :: "explode" :: Nil) |