You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2018/11/12 08:18:08 UTC
[GitHub] spark pull request #22809: [SPARK-19851][SQL] Add support for EVERY and ANY ...
Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/22809#discussion_r232564281
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Max.scala ---
@@ -57,3 +57,34 @@ case class Max(child: Expression) extends DeclarativeAggregate {
override lazy val evaluateExpression: AttributeReference = max
}
+
+abstract class AnyAggBase(arg: Expression)
+ extends UnevaluableAggrgate with ImplicitCastInputTypes {
+
+ override def children: Seq[Expression] = arg :: Nil
+
+ override def dataType: DataType = BooleanType
+
+ override def inputTypes: Seq[AbstractDataType] = Seq(BooleanType)
+
+ override def checkInputDataTypes(): TypeCheckResult = {
+ arg.dataType match {
+ case dt if dt != BooleanType =>
+ TypeCheckResult.TypeCheckFailure(s"Input to function '$prettyName' should have been " +
+ s"${BooleanType.simpleString}, but it's [${arg.dataType.catalogString}].")
+ case _ => TypeCheckResult.TypeCheckSuccess
+ }
+ }
+}
+
+@ExpressionDescription(
+ usage = "_FUNC_(expr) - Returns true if at least one value of `expr` is true.")
--- End diff --
(btw, let's add `since` at `ExpressionDescription` wherever possible .. )
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org