Github user rberenguel commented on a diff in the pull request:
https://github.com/apache/spark/pull/17100#discussion_r146469410
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
---
@@ -408,16 +408,23 @@ 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(
+ val attrA = AttributeReference("a", LongType)(exprId = ExprId(1))
+ val otherA = AttributeReference("a", LongType)(exprId = ExprId(2))
+ val bAlias = Alias(sum(attrA), "b")() :: Nil
+ val plan = Aggregate(
Nil,
- Alias(sum(AttributeReference("a", LongType)(exprId = ExprId(1))),
"b")() :: Nil,
- LocalRelation(
- AttributeReference("a", LongType)(exprId = ExprId(2))))
+ bAlias,
+ LocalRelation(otherA))
assert(plan.resolved)
- assertAnalysisError(plan, "resolved attribute(s) a#1L missing from
a#2L" :: Nil)
+ val errorMsg = s"""Resolved attribute(s) ${attrA.toString} missing
from ${otherA.toString}
+ |in operator !Aggregate [${bAlias.mkString("#")}].
+ |Please check attribute(s) `a`, they seem to appear
in two
+ |different input operators, with the same
name.""".stripMargin
+
+
--- End diff --
Fixed
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]