Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/21537#discussion_r196029083
--- 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)
+ case b: Blocks => Blocks(Seq(this) ++ b.blocks)
--- End diff --
After discussed with @cloud-fan, I think this abstraction `Blocks` is not
necessary. It can be replaced with `CodeBlock`. I will submit a PR to do that.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]