zhengruifeng commented on code in PR #37438:
URL: https://github.com/apache/spark/pull/37438#discussion_r940181869
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala:
##########
@@ -49,7 +49,7 @@ case class Mode(
// Returns null for empty inputs
override def nullable: Boolean = true
- override val dataType: DataType = child.dataType
+ override def dataType: DataType = child.dataType
Review Comment:
this change is needed, otherwise:
```
scala> df.groupBy("a").agg(mode(col("b")))
org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to
dataType on unresolved object
at
org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.dataType(unresolved.scala:137)
at
org.apache.spark.sql.catalyst.expressions.aggregate.Mode.<init>(Mode.scala:52)
at org.apache.spark.sql.functions$.mode(functions.scala:679)
... 49 elided
```
--
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]