beliefer commented on code in PR #44184: URL: https://github.com/apache/spark/pull/44184#discussion_r1421301333
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Mode.scala: ########## @@ -54,52 +53,22 @@ case class Mode( child: Expression, mutableAggBufferOffset: Int = 0, inputAggBufferOffset: Int = 0, - deterministicExpr: Expression = Literal.FalseLiteral) + reverseOpt: Option[Boolean] = None) extends TypedAggregateWithHashMapAsBuffer with ImplicitCastInputTypes - with BinaryLike[Expression] { + with SupportsOrderingWithinGroup with UnaryLike[Expression] { def this(child: Expression) = this(child, 0, 0) - def this(child: Expression, deterministicExpr: Expression) = { - this(child, 0, 0, deterministicExpr) + def this(child: Expression, reverse: Boolean) = { + this(child, 0, 0, Some(reverse)) } - @transient - protected lazy val deterministicResult = deterministicExpr.eval().asInstanceOf[Boolean] - - override def left: Expression = child - - override def right: Expression = deterministicExpr - // Returns null for empty inputs override def nullable: Boolean = true override def dataType: DataType = child.dataType - override def inputTypes: Seq[AbstractDataType] = Seq(AnyDataType, BooleanType) - - override def checkInputDataTypes(): TypeCheckResult = { - val defaultCheck = super.checkInputDataTypes() - if (defaultCheck.isFailure) { - return defaultCheck - } - if (!deterministicExpr.foldable) { - DataTypeMismatch( - errorSubClass = "NON_FOLDABLE_INPUT", Review Comment: OK. Let's keep the back compatibility. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org