Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19901#discussion_r155132721
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala
---
@@ -91,29 +91,36 @@ case class Coalesce(children: Seq[Expression]) extends
Expression {
val codes = ctx.splitExpressionsWithCurrentInputs(
expressions = evals,
funcName = "coalesce",
- makeSplitFunction = func =>
- s"""
- |do {
- | $func
- |} while (false);
- """.stripMargin,
- foldFunctions = _.map { funcCall =>
- s"""
- |$funcCall;
- |if (!${ev.isNull}) {
- | continue;
- |}
- """.stripMargin
- }.mkString)
-
+ extraArguments = (ctx.javaType(dataType), ev.value) :: Nil,
+ returnType = ctx.javaType(dataType),
+ makeSplitFunction = {
+ func =>
+ s"""
+ |do {
+ | $func
+ |} while (false);
+ |return ${ev.value};
+ """.stripMargin
+ },
+ foldFunctions = { funcCalls =>
+ funcCalls.map { funcCall =>
--- End diff --
ditto, please keep the previous code style.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]