[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 3c1305107a
)
Signed-off-by: Michael Armbrust <michael@databricks.com>
This commit is contained in:
parent
afde4019b8
commit
d7660dc2f5
|
@ -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
|
||||
|
|
|
@ -166,6 +166,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)),
|
||||
|
|
Loading…
Reference in a new issue