Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/21193#discussion_r189768074 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/javaCode.scala --- @@ -167,9 +170,40 @@ object Block { case other => throw new IllegalArgumentException( s"Can not interpolate ${other.getClass.getName} into code block.") } - CodeBlock(sc.parts, args) + + val (codeParts, blockInputs) = foldLiteralArgs(sc.parts, args) + CodeBlock(codeParts, blockInputs) + } + } + } + + // Folds eagerly the literal args into the code parts. + private def foldLiteralArgs(parts: Seq[String], args: Seq[Any]): (Seq[String], Seq[Any]) = { + val codeParts = ArrayBuffer.empty[String] + val blockInputs = ArrayBuffer.empty[Any] --- End diff -- Ok. `JavaCode` is better.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org