viirya commented on a change in pull request #28831:
URL: https://github.com/apache/spark/pull/28831#discussion_r442564718
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -118,47 +118,72 @@ case class ConcatWs(children: Seq[Expression])
boolean ${ev.isNull} = ${ev.value} == null;
""")
} else {
+ val isNullArgs = ctx.freshName("isNullArgs")
+ val valueArgs = ctx.freshName("valueArgs")
+
val array = ctx.freshName("array")
val varargNum = ctx.freshName("varargNum")
val idxVararg = ctx.freshName("idxInVararg")
val evals = children.map(_.genCode(ctx))
- val (varargCount, varargBuild) = children.tail.zip(evals.tail).map {
case (child, eval) =>
- child.dataType match {
+ val (argBuild, varargCount, varargBuild) = children.tail.zip(evals.tail)
+ .zipWithIndex.map { case ((child, eval), idx) =>
+ val reprForIsNull = s"$isNullArgs[$idx]"
+ val reprForValue = s"$valueArgs[$idx]"
+
+ val arg =
+ s"""
+ ${eval.code}
+ $reprForIsNull = ${eval.isNull};
+ $reprForValue = ${eval.value};
+ """
+
+ val (varCount, varBuild) = child.dataType match {
case StringType =>
+ val reprForValueCast = s"((UTF8String) $valueArgs[$idx])"
("", // we count all the StringType arguments num at once below.
- if (eval.isNull == TrueLiteral) {
- ""
- } else {
- s"$array[$idxVararg ++] = ${eval.isNull} ? (UTF8String) null :
${eval.value};"
- })
+ if (eval.isNull == TrueLiteral) {
+ ""
+ } else {
+ s"$array[$idxVararg ++] = $reprForIsNull ? (UTF8String) null :
$reprForValueCast;"
+ })
case _: ArrayType =>
+ val reprForValueCast = s"((ArrayData) $valueArgs[$idx])"
Review comment:
s"((ArrayData) $reprForValue)"
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -118,47 +118,72 @@ case class ConcatWs(children: Seq[Expression])
boolean ${ev.isNull} = ${ev.value} == null;
""")
} else {
+ val isNullArgs = ctx.freshName("isNullArgs")
+ val valueArgs = ctx.freshName("valueArgs")
+
val array = ctx.freshName("array")
val varargNum = ctx.freshName("varargNum")
val idxVararg = ctx.freshName("idxInVararg")
val evals = children.map(_.genCode(ctx))
- val (varargCount, varargBuild) = children.tail.zip(evals.tail).map {
case (child, eval) =>
- child.dataType match {
+ val (argBuild, varargCount, varargBuild) = children.tail.zip(evals.tail)
+ .zipWithIndex.map { case ((child, eval), idx) =>
+ val reprForIsNull = s"$isNullArgs[$idx]"
+ val reprForValue = s"$valueArgs[$idx]"
+
+ val arg =
+ s"""
+ ${eval.code}
+ $reprForIsNull = ${eval.isNull};
+ $reprForValue = ${eval.value};
+ """
+
+ val (varCount, varBuild) = child.dataType match {
case StringType =>
+ val reprForValueCast = s"((UTF8String) $valueArgs[$idx])"
Review comment:
s"((UTF8String) $reprForValue)"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]