Skip to content

Commit e5aa90e

Browse files
committed
address review comment
1 parent 47fcdc2 commit e5aa90e

File tree

1 file changed

+11
-11
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+11
-11
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ case class Least(children: Seq[Expression]) extends Expression {
602602

603603
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
604604
val evalChildren = children.map(_.genCode(ctx))
605-
val leastTmpIsNull = ctx.freshName("leastTmpIsNull")
606-
ctx.addMutableState(ctx.JAVA_BOOLEAN, leastTmpIsNull)
605+
val tmpIsNull = ctx.freshName("leastTmpIsNull")
606+
ctx.addMutableState(ctx.JAVA_BOOLEAN, tmpIsNull)
607607
val evals = evalChildren.map(eval =>
608608
s"""
609609
|${eval.code}
610-
|if (!${eval.isNull} && (${leastTmpIsNull} ||
610+
|if (!${eval.isNull} && ($tmpIsNull ||
611611
| ${ctx.genGreater(dataType, ev.value, eval.value)})) {
612-
| $leastTmpIsNull = false;
612+
| $tmpIsNull = false;
613613
| ${ev.value} = ${eval.value};
614614
|}
615615
""".stripMargin
@@ -629,10 +629,10 @@ case class Least(children: Seq[Expression]) extends Expression {
629629
foldFunctions = _.map(funcCall => s"${ev.value} = $funcCall;").mkString("\n"))
630630
ev.copy(code =
631631
s"""
632-
|$leastTmpIsNull = true;
632+
|$tmpIsNull = true;
633633
|${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
634634
|$codes
635-
|final boolean ${ev.isNull} = $leastTmpIsNull;
635+
|final boolean ${ev.isNull} = $tmpIsNull;
636636
""".stripMargin)
637637
}
638638
}
@@ -683,14 +683,14 @@ case class Greatest(children: Seq[Expression]) extends Expression {
683683

684684
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
685685
val evalChildren = children.map(_.genCode(ctx))
686-
val greatestTmpIsNull = ctx.freshName("greatestTmpIsNull")
686+
val tmpIsNull = ctx.freshName("greatestTmpIsNull")
687687
ctx.addMutableState(ctx.JAVA_BOOLEAN, greatestTmpIsNull)
688688
val evals = evalChildren.map(eval =>
689689
s"""
690690
|${eval.code}
691-
|if (!${eval.isNull} && (${greatestTmpIsNull} ||
691+
|if (!${eval.isNull} && ($tmpIsNull ||
692692
| ${ctx.genGreater(dataType, eval.value, ev.value)})) {
693-
| $greatestTmpIsNull = false;
693+
| $tmpIsNull = false;
694694
| ${ev.value} = ${eval.value};
695695
|}
696696
""".stripMargin
@@ -710,10 +710,10 @@ case class Greatest(children: Seq[Expression]) extends Expression {
710710
foldFunctions = _.map(funcCall => s"${ev.value} = $funcCall;").mkString("\n"))
711711
ev.copy(code =
712712
s"""
713-
|$greatestTmpIsNull = true;
713+
|$tmpIsNull = true;
714714
|${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)};
715715
|$codes
716-
|final boolean ${ev.isNull} = $greatestTmpIsNull;
716+
|final boolean ${ev.isNull} = $tmpIsNull;
717717
""".stripMargin)
718718
}
719719
}

0 commit comments

Comments
 (0)