Github user rberenguel commented on a diff in the pull request:
https://github.com/apache/spark/pull/17100#discussion_r146128092
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
---
@@ -408,16 +408,28 @@ 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 aId = Array[String](attrA.name, attrA.exprId.id.toString)
+ val otherA = AttributeReference("a", LongType)(exprId = ExprId(2))
+ val otherAId = Array[String](otherA.name, otherA.exprId.id.toString)
+ 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"""Some resolved attribute(s) are not present among
the available attributes
+ |for a query.
+ |${aId.mkString("#")}L is not in
${otherAId.mkString("#")}L.
--- End diff --
Yes thanks, I discovered this recently, but didn't come back to this PR.
Will fix
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]