Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/19324#discussion_r141060165
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
---
@@ -328,6 +331,22 @@ class CodegenContext {
(inlinedFunctions ++ initNestedClasses ++
declareNestedClasses).mkString("\n")
}
+ /**
+ * Emits any source code added with addExtraCode
+ */
+ def emitExtraCode(): String = {
+ extraCode.mkString("\n")
+ }
+
+ /**
+ * Add extra source code to the outermost generated class.
+ * @param code verbatim source code to be added.
+ */
+ def addExtraCode(code: String): Unit = {
--- End diff --
+1 Although it doesn't prevent you going to add functions, but we have
`addNewFunction` for it. So we'd better claim that this is just for inner class.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]