Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/19777#discussion_r207077435
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
---
@@ -125,13 +125,34 @@ case class ConcatWs(children: Seq[Expression])
if (children.forall(_.dataType == StringType)) {
// All children are strings. In that case we can construct a fixed
size array.
val evals = children.map(_.genCode(ctx))
-
- val inputs = evals.map { eval =>
- s"${eval.isNull} ? (UTF8String) null : ${eval.value}"
- }.mkString(", ")
-
- ev.copy(evals.map(_.code).mkString("\n") + s"""
- UTF8String ${ev.value} = UTF8String.concatWs($inputs);
+ val separator = evals.head
+ val strings = evals.tail
+ val numArgs = strings.length
+ val args = ctx.freshName("args")
+
+ val inputs = strings.zipWithIndex.map { case (eval, index) =>
+ if (eval.isNull != "true") {
--- End diff --
@kiszk I was looking at build warnings and it notes that this compares a
`ExprValue` and `String` and they will always not be equal. Should it be
`eval.isNull.code != "true"` maybe?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]