Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/6851#discussion_r32601495
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionals.scala
---
@@ -312,3 +312,63 @@ case class CaseKeyWhen(key: Expression, branches:
Seq[Expression]) extends CaseW
}.mkString
}
}
+
+case class Least(children: Expression*)
+ extends Expression {
+
+ override def nullable: Boolean = children.forall(_.nullable)
+
+ override def checkInputDataTypes(): TypeCheckResult = {
+ if (children.map(_.dataType).distinct.size > 1) {
+ TypeCheckResult.TypeCheckFailure(
+ s"differing types in Least (${children.map(_.dataType)}).")
+ } else {
+ TypeCheckResult.TypeCheckSuccess
+ }
+ }
+
+ override def dataType: DataType = children.head.dataType
+
+ override def eval(input: InternalRow): Any = {
+ val cmp = GreaterThan
--- End diff --
Can we make it as the property of the class? We don't want to create new
instance for every row, right? And don't forget to mark it as `transient`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]