Skip to content
Snippets Groups Projects
Commit 2a41c0d7 authored by Michael Armbrust's avatar Michael Armbrust Committed by Reynold Xin
Browse files

[SPARK-7569][SQL] Better error for invalid binary expressions

`scala> Seq((1,1)).toDF("a", "b").select(lit(1) + new java.sql.Date(1)) `

Before:

```
org.apache.spark.sql.AnalysisException: invalid expression (1 + 0) between Literal 1, IntegerType and Literal 0, DateType;
```

After:
```
org.apache.spark.sql.AnalysisException: invalid expression (1 + 0) between int and date;
```

Author: Michael Armbrust <michael@databricks.com>

Closes #6089 from marmbrus/betterBinaryError and squashes the following commits:

23b68ad [Michael Armbrust] [SPARK-7569][SQL] Better error for invalid binary expressions
parent 595a6758
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,7 @@ trait CheckAnalysis { ...@@ -69,7 +69,7 @@ trait CheckAnalysis {
case b: BinaryExpression if !b.resolved => case b: BinaryExpression if !b.resolved =>
failAnalysis( failAnalysis(
s"invalid expression ${b.prettyString} " + s"invalid expression ${b.prettyString} " +
s"between ${b.left.simpleString} and ${b.right.simpleString}") s"between ${b.left.dataType.simpleString} and ${b.right.dataType.simpleString}")
case w @ WindowExpression(windowFunction, windowSpec) if windowSpec.validate.nonEmpty => case w @ WindowExpression(windowFunction, windowSpec) if windowSpec.validate.nonEmpty =>
// The window spec is not valid. // The window spec is not valid.
......
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