[ https://issues.apache.org/jira/browse/FLINK-6693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083492#comment-16083492 ]
ASF GitHub Bot commented on FLINK-6693: --------------------------------------- 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. > Support DATE_FORMAT function in the Table / SQL API > --------------------------------------------------- > > Key: FLINK-6693 > URL: https://issues.apache.org/jira/browse/FLINK-6693 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL > Reporter: Haohui Mai > Assignee: Haohui Mai > > It would be quite handy to support the {{DATE_FORMAT}} function in Flink to > support various date / time related operations: > The specification of the {{DATE_FORMAT}} function can be found in > https://prestodb.io/docs/current/functions/datetime.html. -- This message was sent by Atlassian JIRA (v6.4.14#64029)