Repository: spark
Updated Branches:
refs/heads/master 3ff012051 -> 665545960
[SPARK-15265][SQL][MINOR] Fix Union query error message indentation
## What changes were proposed in this pull request?
This issue fixes the error message indentation consistently with other set
queries (EXCEPT/INTERSECT).
**Before (4 lines)**
```
scala> sql("(select 1) union (select 1, 2)").head
org.apache.spark.sql.AnalysisException:
Unions can only be performed on tables with the same number of columns,
but one table has '2' columns and another table has
'1' columns;
```
**After (one-line)**
```
scala> sql("(select 1) union (select 1, 2)").head
org.apache.spark.sql.AnalysisException: Unions can only be performed on tables
with the same number of columns, but one table has '2' columns and another
table has '1' columns;
```
**Reference (EXCEPT / INTERSECT)**
```
scala> sql("(select 1) intersect (select 1, 2)").head
org.apache.spark.sql.AnalysisException: Intersect can only be performed on
tables with the same number of columns, but the left table has 1 columns and
the right has 2;
```
## How was this patch tested?
Manual.
Author: Dongjoon Hyun <[email protected]>
Closes #13043 from dongjoon-hyun/SPARK-15265.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/66554596
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/66554596
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/66554596
Branch: refs/heads/master
Commit: 66554596064303757b921ebef683c3506d749775
Parents: 3ff0120
Author: Dongjoon Hyun <[email protected]>
Authored: Tue May 10 22:27:22 2016 -0700
Committer: Reynold Xin <[email protected]>
Committed: Tue May 10 22:27:22 2016 -0700
----------------------------------------------------------------------
.../spark/sql/catalyst/analysis/CheckAnalysis.scala | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/66554596/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 74197c4..28aa249 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
@@ -241,16 +241,15 @@ trait CheckAnalysis extends PredicateHelper {
case s @ SetOperation(left, right) if left.output.length !=
right.output.length =>
failAnalysis(
s"${s.nodeName} can only be performed on tables with the same
number of columns, " +
- s"but the left table has ${left.output.length} columns and the
right has " +
- s"${right.output.length}")
+ s"but the left table has ${left.output.length} columns and the
right has " +
+ s"${right.output.length}")
case s: Union if s.children.exists(_.output.length !=
s.children.head.output.length) =>
val firstError = s.children.find(_.output.length !=
s.children.head.output.length).get
failAnalysis(
- s"""
- |Unions can only be performed on tables with the same number
of columns,
- | but one table has '${firstError.output.length}' columns and
another table has
- | '${s.children.head.output.length}' columns""".stripMargin)
+ s"Unions can only be performed on tables with the same number of
columns, " +
+ s"but one table has '${firstError.output.length}' columns and
another table has " +
+ s"'${s.children.head.output.length}' columns")
case p if
p.expressions.exists(ScalarSubquery.hasCorrelatedScalarSubquery) =>
p match {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]