Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/21537#discussion_r196769133
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/javaCode.scala
---
@@ -256,6 +283,22 @@ object EmptyBlock extends Block with Serializable {
override def + (other: Block): Block = other
}
+/**
+ * A block inlines all types of input arguments into a string without
+ * tracking any reference of `JavaCode` instances.
+ */
+case class InlineBlock(block: String) extends Block {
+ override val code: String = block
+ override val exprValues: Set[ExprValue] = Set.empty
+
+ override def + (other: Block): Block = other match {
+ case c: CodeBlock => Blocks(Seq(this, c))
+ case i: InlineBlock => InlineBlock(block + i.block)
--- End diff --
I think we won't have too many cases of concatenating `InlineBlock`. You
can see `InlineBlock` is mostly used to wrap a small piece of code like a java
class name. I'm not sure if we need to add a newline here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]