Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19901#discussion_r155132680
--- 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,
--- End diff --
we don't need to pass it as a parameter, just create a local variable at
the beginning of the generated method:
```
${ctx.javaType(dataType)} ${ev.value} = default...
do {
$func
} while (false);
return ${ev.value};
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]