Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/19324#discussion_r141058787
--- 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 = {
+ extraCode.append(code)
+ classSize(outerClassName) += code.length
--- End diff --
The `classSize` is mainly used to deal with the limit of number of named
constants. So I think we don't need to add extra code size into it, if we only
add inner class?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]