Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/6872#discussion_r33111408
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
---
@@ -221,6 +221,60 @@ private[sql] object BinaryExpression {
def unapply(e: BinaryExpression): Option[(Expression, Expression)] =
Some((e.left, e.right))
}
+abstract class TernaryExpression extends Expression with
trees.TernaryNode[Expression] {
+ self: Product =>
+
+ def symbol: String = sys.error(s"TernaryExpressions must override either
toString or symbol")
+
+ override def foldable: Boolean = first.foldable && second.foldable &&
third.foldable
+
+ override def nullable: Boolean = first.nullable || second.nullable ||
third.nullable
+
+ override def toString: String = s"($symbol ($first, $second, $third))"
+
+ override def isThreadSafe: Boolean = first.isThreadSafe &&
second.isThreadSafe &&
+ third.isThreadSafe
+ /**
+ * Short hand for generating binary evaluation code, which depends on
two sub-evaluations of
+ * the same type. If either of the sub-expressions is null, the result
of this computation
+ * is assumed to be null.
+ *
+ * @param f accepts two variable names and returns Java code to compute
the output.
+ */
+ protected def defineCodeGen(
+ ctx: CodeGenContext,
--- End diff --
Nit: spaces => 2 spaces indent
---
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]