spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marmb...@apache.org
Subject spark git commit: [SPARK-7834] [SQL] Better window error messages
Date Sat, 23 May 2015 00:23:57 GMT
Repository: spark
Updated Branches:
  refs/heads/branch-1.4 afde4019b -> d7660dc2f


[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

(cherry picked from commit 3c1305107a2d6d2de862e8b41dbad0e85585b1ef)
Signed-off-by: Michael Armbrust <michael@databricks.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d7660dc2
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d7660dc2
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d7660dc2

Branch: refs/heads/branch-1.4
Commit: d7660dc2f5c53dd6b3ffc57b05c0daa67a16f5f3
Parents: afde401
Author: Michael Armbrust <michael@databricks.com>
Authored: Fri May 22 17:23:12 2015 -0700
Committer: Michael Armbrust <michael@databricks.com>
Committed: Fri May 22 17:23:53 2015 -0700

----------------------------------------------------------------------
 .../spark/sql/catalyst/analysis/CheckAnalysis.scala    |  5 +++++
 .../spark/sql/catalyst/analysis/AnalysisSuite.scala    | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/d7660dc2/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
----------------------------------------------------------------------
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 06a0504..193dc6b 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

http://git-wip-us.apache.org/repos/asf/spark/blob/d7660dc2/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
----------------------------------------------------------------------
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 e1d6ac4..939cefb 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)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message