@@ -309,17 +309,11 @@ trait DivModLike extends BinaryArithmetic {
309
309
310
310
override def nullable : Boolean = true
311
311
312
- final override def eval (input : InternalRow ): Any = {
313
- val input2 = right.eval(input)
314
- if (input2 == null || input2 == 0 ) {
312
+ final override def nullSafeEval (input1 : Any , input2 : Any ): Any = {
313
+ if (input2 == 0 ) {
315
314
null
316
315
} else {
317
- val input1 = left.eval(input)
318
- if (input1 == null ) {
319
- null
320
- } else {
321
- evalOperation(input1, input2)
322
- }
316
+ evalOperation(input1, input2)
323
317
}
324
318
}
325
319
@@ -516,24 +510,18 @@ case class Pmod(left: Expression, right: Expression) extends BinaryArithmetic {
516
510
517
511
override def nullable : Boolean = true
518
512
519
- override def eval (input : InternalRow ): Any = {
520
- val input2 = right.eval(input)
521
- if (input2 == null || input2 == 0 ) {
513
+ override def nullSafeEval (input1 : Any , input2 : Any ): Any = {
514
+ if (input2 == 0 ) {
522
515
null
523
516
} else {
524
- val input1 = left.eval(input)
525
- if (input1 == null ) {
526
- null
527
- } else {
528
- input1 match {
529
- case i : Integer => pmod(i, input2.asInstanceOf [java.lang.Integer ])
530
- case l : Long => pmod(l, input2.asInstanceOf [java.lang.Long ])
531
- case s : Short => pmod(s, input2.asInstanceOf [java.lang.Short ])
532
- case b : Byte => pmod(b, input2.asInstanceOf [java.lang.Byte ])
533
- case f : Float => pmod(f, input2.asInstanceOf [java.lang.Float ])
534
- case d : Double => pmod(d, input2.asInstanceOf [java.lang.Double ])
535
- case d : Decimal => pmod(d, input2.asInstanceOf [Decimal ])
536
- }
517
+ input1 match {
518
+ case i : Integer => pmod(i, input2.asInstanceOf [java.lang.Integer ])
519
+ case l : Long => pmod(l, input2.asInstanceOf [java.lang.Long ])
520
+ case s : Short => pmod(s, input2.asInstanceOf [java.lang.Short ])
521
+ case b : Byte => pmod(b, input2.asInstanceOf [java.lang.Byte ])
522
+ case f : Float => pmod(f, input2.asInstanceOf [java.lang.Float ])
523
+ case d : Double => pmod(d, input2.asInstanceOf [java.lang.Double ])
524
+ case d : Decimal => pmod(d, input2.asInstanceOf [Decimal ])
537
525
}
538
526
}
539
527
}
0 commit comments