Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
981224b
SPARK-13947 Rewritten error message for clarity. Added extra informat…
rberenguel Feb 28, 2017
ea07688
SPARK-13947 Regenerated the golden file with the updated error messag…
rberenguel Mar 1, 2017
65b9596
SPARK-13947 Regenerated golden file after formatting fix. Fixed the A…
rberenguel Mar 1, 2017
c99229c
SPARK-13947 Code review improvements
Mar 21, 2017
7bb6f35
Merge branch 'master' into SPARK-13947-error-message
Mar 21, 2017
4ac8143
SPARK-13947 Not sure about these changes, but passes the local suite …
May 3, 2017
766a033
Merge branch 'master' into SPARK-13947-error-message
rberenguel May 3, 2017
c2dfe11
SPARK-13947 Never quick-edit a non-clean merge after 1 AM
May 3, 2017
dcf0b2c
Merge branch 'master' into SPARK-13947-error-message
rberenguel May 29, 2017
0cb9825
Merge branch 'master' into SPARK-13947-error-message
rberenguel May 29, 2017
6bbe496
Merge branch 'master' into SPARK-13947-error-message
rberenguel Oct 21, 2017
75be390
SPARK-13947 Code review modifications. AnalysisErrorSuite passes, but…
rberenguel Oct 22, 2017
6e8ab42
SPARK-13947 Another batch of code review modifications
rberenguel Oct 23, 2017
72b72cf
SPARK-13947 Another batch of code review modifications
rberenguel Oct 23, 2017
33a8a71
SPARK-13947 Format change for a lambda
rberenguel Oct 23, 2017
e3cc455
SPARK-13947 Improve the final formatting
rberenguel Oct 23, 2017
34753b5
SPARK-13947 Test and message improvements
rberenguel Oct 23, 2017
b8fbdea
SPARK-13947 More code review changes
rberenguel Oct 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,23 @@ trait CheckAnalysis extends PredicateHelper {
case o if o.children.nonEmpty && o.missingInput.nonEmpty =>
val missingAttributes = o.missingInput.mkString(",")
val input = o.inputSet.mkString(",")
val msgForMissingAttributes = s"Resolved attribute(s) $missingAttributes missing " +
s"from $input in operator ${operator.simpleString}."

failAnalysis(
s"resolved attribute(s) $missingAttributes missing from $input " +
s"in operator ${operator.simpleString}")
val resolver = plan.conf.resolver
val attrsWithSameName = o.missingInput.filter { missing =>
o.inputSet.exists(input => resolver(missing.name, input.name))
}

val msg = if (attrsWithSameName.nonEmpty) {
val sameNames = attrsWithSameName.map(_.name).mkString(",")
s"$msgForMissingAttributes Attribute(s) with the same name appear in the " +
s"operation: $sameNames. Please check if the right attribute(s) are used."
} else {
msgForMissingAttributes
}

failAnalysis(msg)

case p @ Project(exprs, _) if containsMultipleGenerators(exprs) =>
failAnalysis(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,25 @@ class AnalysisErrorSuite extends AnalysisTest {
// CheckAnalysis should throw AnalysisException when Aggregate contains missing attribute(s)
// Since we manually construct the logical plan at here and Sum only accept
// LongType, DoubleType, and DecimalType. We use LongType as the type of a.
val plan =
Aggregate(
Nil,
Alias(sum(AttributeReference("a", LongType)(exprId = ExprId(1))), "b")() :: Nil,
LocalRelation(
AttributeReference("a", LongType)(exprId = ExprId(2))))
val attrA = AttributeReference("a", LongType)(exprId = ExprId(1))
val otherA = AttributeReference("a", LongType)(exprId = ExprId(2))
val attrC = AttributeReference("c", LongType)(exprId = ExprId(3))
val aliases = Alias(sum(attrA), "b")() :: Alias(sum(attrC), "d")() :: Nil
val plan = Aggregate(
Nil,
aliases,
LocalRelation(otherA))

assert(plan.resolved)

assertAnalysisError(plan, "resolved attribute(s) a#1L missing from a#2L" :: Nil)
val resolved = s"${attrA.toString},${attrC.toString}"

val errorMsg = s"Resolved attribute(s) $resolved missing from ${otherA.toString} " +
s"in operator !Aggregate [${aliases.mkString(", ")}]. " +
s"Attribute(s) with the same name appear in the operation: a. " +
"Please check if the right attribute(s) are used."

assertAnalysisError(plan, errorMsg :: Nil)
}

test("error test for self-join") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ WHERE t1a IN (SELECT min(t2a)
struct<>
-- !query 4 output
org.apache.spark.sql.AnalysisException
resolved attribute(s) t2b#x missing from min(t2a)#x,t2c#x in operator !Filter t2c#x IN (list#x [t2b#x]);
Resolved attribute(s) t2b#x missing from min(t2a)#x,t2c#x in operator !Filter t2c#x IN (list#x [t2b#x]).;


-- !query 5
Expand Down