[ 
https://issues.apache.org/jira/browse/FLINK-8136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16262908#comment-16262908
 ] 

ASF GitHub Bot commented on FLINK-8136:
---------------------------------------

GitHub user twalthr opened a pull request:

    https://github.com/apache/flink/pull/5054

    [FLINK-8136] [table] Fix code generation with JodaTime shading

    ## What is the purpose of the change
    
    Fix `DATE_FORMAT` with shaded JodaTime.
    
    
    ## Brief change log
    
    Do not use hard-coded class name in code generation.
    
    
    ## Verifying this change
    
    This change is already covered by existing tests.
    
    ## Does this pull request potentially affect one of the following parts:
    
    no
    
    ## Documentation
    
      - Does this pull request introduce a new feature? no
      - If yes, how is the feature documented? not applicable


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/twalthr/flink FLINK-8136

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/5054.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #5054
    
----
commit f50ae50c8e20ac025088c02aac56452f7013d77b
Author: twalthr <[email protected]>
Date:   2017-11-22T16:43:08Z

    [FLINK-8136] [table] Fix code generation with JodaTime shading

----


> Cast exception error on Flink SQL when using DATE_FORMAT
> --------------------------------------------------------
>
>                 Key: FLINK-8136
>                 URL: https://issues.apache.org/jira/browse/FLINK-8136
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.4.0
>         Environment: Any environment
>            Reporter: David Marcos
>            Assignee: Timo Walther
>            Priority: Blocker
>
> 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



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to