Github user haohui commented on a diff in the pull request:
https://github.com/apache/flink/pull/4078#discussion_r126870280
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala
---
@@ -2008,6 +2008,33 @@ class CodeGenerator(
}
/**
+ * Adds a reusable [[java.util.Random]] to the member area of the
generated [[Function]].
+ *
+ * The seed parameter must be a literal/constant expression.
+ *
+ * @return member variable term
+ */
+ def addReusableDateFormatter(format: GeneratedExpression): String = {
+ val fieldTerm = newName("dateFormatter")
+
+ val field =
+ s"""
+ |transient org.joda.time.format.DateTimeFormatter $fieldTerm;
+ |""".stripMargin
+ reusableMemberStatements.add(field)
+
+ val fieldInit =
+ s"""
+ |${format.code}
+ |$fieldTerm = org.apache.flink.table.runtime.functions.
+
|DateTimeFunctions$$.MODULE$$.createDateTimeFormatter(${format.resultTerm});
--- End diff --
This is because the runtime ``DateTimeFunctions`` has been ported to Scala.
This is the syntax to access the function.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---