Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19811#discussion_r156875671
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateMutableProjection.scala
---
@@ -60,38 +60,32 @@ object GenerateMutableProjection extends
CodeGenerator[Seq[Expression], MutableP
val projectionCodes = exprVals.zip(index).map {
case (ev, i) =>
val e = expressions(i)
+ val value = ctx.addMutableState(ctx.javaType(e.dataType), "value")
if (e.nullable) {
- val isNull = s"isNull_$i"
- val value = s"value_$i"
- ctx.addMutableState(ctx.JAVA_BOOLEAN, isNull, s"$isNull = true;")
- ctx.addMutableState(ctx.javaType(e.dataType), value,
- s"$value = ${ctx.defaultValue(e.dataType)};")
- s"""
- ${ev.code}
- $isNull = ${ev.isNull};
- $value = ${ev.value};
- """
+ val isNull = ctx.addMutableState(ctx.JAVA_BOOLEAN, "isNull")
+ (s"""
+ ${ev.code}
+ $isNull = ${ev.isNull};
+ $value = ${ev.value};
--- End diff --
since we are changing it, let's update the style to
```
s"""
|
""".strimMargin
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]