jnh5y commented on code in PR #30058:
URL: https://github.com/apache/flink/pull/30058#discussion_r4648393319
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/ScalarOperatorGens.scala:
##########
@@ -1104,6 +1104,23 @@ object ScalarOperatorGens {
}
val elseAction = generateCast(ctx, operands.last, resultType,
nullOnFailure = true)
+ // one WHEN, as in IF, nests no deeper with an else, so it needs no done
flag
+ if (whens.size == 1) {
+ val (condition, trueAction) = whens.head
+ val code =
+ s"""
+ |$resultTypeTerm $resultTerm = $defaultValue;
+ |boolean $nullTerm = true;
+ |${condition.code}
+ |if (${condition.resultTerm}) {
+ | ${assign(trueAction)}
+ |} else {
+ | ${assign(elseAction)}
+ |}
+ |""".stripMargin.trim
+ return GeneratedExpression(resultTerm, nullTerm, code, resultType)
Review Comment:
No test? ;)
If a test is trivial, maybe it is worth one? I'm not going to push on it
though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]