Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19901#discussion_r155132048
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala
---
@@ -240,31 +239,35 @@ case class CaseWhen(
val codes = ctx.splitExpressionsWithCurrentInputs(
expressions = allConditions,
funcName = "caseWhen",
- returnType = ctx.JAVA_BOOLEAN,
- makeSplitFunction = func =>
- s"""
- |${ctx.JAVA_BOOLEAN} $conditionMet = false;
- |do {
- | $func
- |} while (false);
- |return $conditionMet;
- """.stripMargin,
- foldFunctions = _.map { funcCall =>
- s"""
- |$conditionMet = $funcCall;
- |if ($conditionMet) {
- | continue;
- |}
- """.stripMargin
- }.mkString)
+ returnType = ctx.JAVA_BYTE,
+ makeSplitFunction = {
+ func =>
+ s"""
+ ${ctx.JAVA_BYTE} $conditionMet = -1;
+ do {
+ $func
+ } while (false);
+ return $conditionMet;
+ """
+ },
+ foldFunctions = { funcCalls =>
+ funcCalls.map { funcCall =>
--- End diff --
can you keep the previous code style?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]