@@ -309,17 +309,11 @@ trait DivModLike extends BinaryArithmetic {
309309
310310 override def nullable : Boolean = true
311311
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 ) {
315314 null
316315 } else {
317- val input1 = left.eval(input)
318- if (input1 == null ) {
319- null
320- } else {
321- evalOperation(input1, input2)
322- }
316+ evalOperation(input1, input2)
323317 }
324318 }
325319
@@ -516,24 +510,18 @@ case class Pmod(left: Expression, right: Expression) extends BinaryArithmetic {
516510
517511 override def nullable : Boolean = true
518512
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 ) {
522515 null
523516 } 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 ])
537525 }
538526 }
539527 }
0 commit comments