Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7398#discussion_r34653709
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
---
@@ -105,12 +113,30 @@ case class Add(left: Expression, right: Expression)
extends BinaryArithmetic {
private lazy val numeric = TypeUtils.getNumeric(dataType)
- protected override def nullSafeEval(input1: Any, input2: Any): Any =
numeric.plus(input1, input2)
+ protected override def nullSafeEval(input1: Any, input2: Any): Any = {
+ if (dataType.isInstanceOf[IntervalType]) {
+ input1.asInstanceOf[Interval].add(input2.asInstanceOf[Interval])
+ } else {
+ numeric.plus(input1, input2)
+ }
+ }
+
+ override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode):
String = dataType match {
+ case dt: DecimalType =>
+ defineCodeGen(ctx, ev, (eval1, eval2) =>
s"$eval1.$decimalMethod($eval2)")
--- End diff --
just inline $decimalMethod here; don't define the function anymore.
---
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]