You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/06 19:18:23 UTC

[GitHub] [spark] amaliujia commented on a change in pull request #35404: [SPARK-38118][SQL] MEAN(Boolean) in the HAVING claus should throw data mismatch error

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org