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 2020/11/30 03:16:18 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #30541: [SPARK-28646][SQL] Fix bug of Count so as consistent with mainstream databases

HyukjinKwon commented on a change in pull request #30541:
URL: https://github.com/apache/spark/pull/30541#discussion_r532326737



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Count.scala
##########
@@ -43,6 +43,9 @@ import org.apache.spark.sql.types._
   since = "1.0.0")
 // scalastyle:on line.size.limit
 case class Count(children: Seq[Expression]) extends DeclarativeAggregate {
+
+  require(children.nonEmpty, s"$prettyName requires at least one argument.")
+

Review comment:
       Can you do it in `checkInputDataTypes`?, e.g.)
   
   ```scala
   override def checkInputDataTypes(): TypeCheckResult = if (children.length <= 1) {
       TypeCheckResult.TypeCheckFailure("blah blah")
   } else {
     TypeCheckResult.TypeCheckSuccess
   }
   ```




----------------------------------------------------------------
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.

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