amaliujia commented on a change in pull request #35404:
URL: https://github.com/apache/spark/pull/35404#discussion_r800221992
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Average.scala
##########
@@ -46,6 +46,8 @@ case class Average(
def this(child: Expression) = this(child, failOnError =
SQLConf.get.ansiEnabled)
+ override lazy val resolved: Boolean = children.forall(_.resolved)
Review comment:
Before this change, this `resolved` field of Average is set based on
both children all resolved and input data type match (the default Expression
implementation). However this will lead to un-resolved column name with Average
in HAVING due to the logic of TempResolveColumn, which lead to column not found
(but the column was found).
If we set this field only based on if all children are resolved, later in
`CheckAnalysis` it will check expression input data type, and throw right `data
type mismatch` error:
https://github.com/apache/spark/blob/0d56c947f10f747ab4b76426b2d6a34a1d3b8277/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L189
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]