Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19827#discussion_r153512337
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
---
@@ -351,24 +351,25 @@ case class CreateNamedStruct(children:
Seq[Expression]) extends CreateNamedStruc
val rowClass = classOf[GenericInternalRow].getName
val values = ctx.freshName("values")
ctx.addMutableState("Object[]", values, s"$values = null;")
-
- ev.copy(code = s"""
- $values = new Object[${valExprs.size}];""" +
- ctx.splitExpressions(
- ctx.INPUT_ROW,
- valExprs.zipWithIndex.map { case (e, i) =>
- val eval = e.genCode(ctx)
- eval.code + s"""
+ val valuesCode = ctx.splitExpressions(
+ valExprs.zipWithIndex.map { case (e, i) =>
+ val eval = e.genCode(ctx)
+ s"""
+ ${eval.code}
if (${eval.isNull}) {
$values[$i] = null;
} else {
$values[$i] = ${eval.value};
}"""
--- End diff --
yea, but let's not block this PR by those existing code style issues, we
still have a lot of chances to fix them in future codegen PRs :)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]