Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4736#discussion_r142247401
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala
---
@@ -1670,4 +1670,34 @@ abstract class CodeGenerator(
fieldTerm
}
+
+ /**
+ * Adds a reusable constant to the member area of the generated
[[Function]].
+ *
+ * @param constant constant expression
+ * @return member variable term
+ */
+ def addReusableBoxedConstant(constant: GeneratedExpression): String = {
+ require(constant.literal, "Literal expected")
+
+ val fieldTerm = newName("constant")
+
+ val boxed = generateOutputFieldBoxing(constant)
+ val boxedType = boxedTypeTermForTypeInfo(boxed.resultType)
+
+ val field =
+ s"""
+ |transient $boxedType $fieldTerm;
--- End diff --
why `transient`? Couldn't this be `final`?
---