GitHub user walterddr opened a pull request:

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

    [FLINK-8215][Table] fix codegen issue on array/map value constructor 
dealing with implicit type cast

    ## What is the purpose of the change
    
    This pull request fix the codegen issue when value constructor on SQL API.
    On Table API we enforce strict type compatibility and no implicit type cast 
is allowed. However on SQL API, Calcite `SqlMultisetValueConstructor` is trying 
to process some combination of types where `leastRestrictive` type is resolved 
correctly. 
    
    A type-cast-safe method is introduce to avoid such codegen excpetion.
    
    
    ## Brief change log
    
    - Added in `generateCast` before boxing the nullable item
    - Added in unit-test for Map / Array value constructor
    
    
    ## Verifying this change
    
    - Unit tests are added.
    
    ## Does this pull request potentially affect one of the following parts:
    
    No
    
    ## Documentation
    
    No new feature required.


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

    $ git pull https://github.com/walterddr/flink FLINK-8215

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

    https://github.com/apache/flink/pull/5148.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 #5148
    
----
commit f8eb55d80fc5232f7989e3e48666257bd4383042
Author: Rong Rong <[email protected]>
Date:   2017-12-11T22:55:49Z

    before generating output type boxing, try a generateCast on the expression 
beforehand. This is to avoid doing an invalid type cast directly such as: 
(Java.util.Double) 1.0f.

----


---

Reply via email to