Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-8136

Cast exception error on Flink SQL when using DATE_FORMAT

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0, 1.5.0
    • Component/s: Table SQL / API
    • Labels:
      None
    • Environment:

      Any environment

      Description

      Due to the shading of joda time there is a exception when CodeGenerator try to cast org.joda.time.format.DateTimeFormatter to org.apache.flink.table.shaded.org.joda.time.format.DateTimeFormatter

      This can be reproduce by using DATE_FORMAT temporal function in any flink SQL

      Affected scala file:
      ------------------------
      https://github.com/apache/flink/blob/master/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala

      Affected method:
      --------------------------
      addReusableDateFormatter

      Affected code:
      -----------------------
      val field =
      s"""

      final org.joda.time.format.DateTimeFormatter $fieldTerm;
      """.stripMargin

      Fastest solution:
      -----------------------
      val field =
      s"""

      final org.apache.flink.table.shaded.org.joda.time.format.DateTimeFormatter $fieldTerm;
      """.stripMargin

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                twalthr Timo Walther
                Reporter:
                davidmar David Marcos
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: