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

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

GitHub user walterddr opened a pull request:

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

    [FLINK-7922][Table API]make FlinkTypeFactory override leastRestrictive to 
work with Nullable composite types while using super class method to handle 
basic type 

    
    ## What is the purpose of the change
    
    This pull request address usage of multiple composite type operation such 
as UNION or CASE WHEN where incorrect output RelDataType was generated due to 
the fact that Calcite automatically resolve result into basic type or Generic 
Relation Data Type with false nullability.
    
    ## Brief change log
    Changed leastRestrictive function to resolve types with all identical 
typeinfomation directly instead of calling the super class method. 
    Throw exception on ANY as we only support ANY with exact same types across 
all operands.
    Invoke super class if not correctly resolved.
    
    
    ## Verifying this change
    Integration test and unit test included to address UNION ALL and CASE WHEN.
    
    
    ## Does this pull request potentially affect one of the following parts:
    no
    
    ## Documentation
    no


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

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

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

    https://github.com/apache/flink/pull/4929.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 #4929
    
----
commit 1f6a452be6233f5d18a80802f58b78baa708d15c
Author: Rong Rong <ro...@uber.com>
Date:   2017-10-31T18:05:38Z

    make FlinkTypeFactory override leastRestrictive to work with composite but 
all equivalent types, include Nullable and Any typaes.

----


> leastRestrictive in FlinkTypeFactory does not resolve composite type correctly
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-7922
>                 URL: https://issues.apache.org/jira/browse/FLINK-7922
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.4.0
>            Reporter: Rong Rong
>            Assignee: Rong Rong
>
> FlinkTypeFactory does not override the following function correctly:
> {code:java}
> def leastRestrictive(types: util.List[RelDataType]): RelDataType = {
>   //... 
> }
> {code}
> dealing with SQL such as:
> {code:sql}
> CASE 
>   WHEN <CONDITION> THEN 
>     <COMPOSITE_TYPE> 
>   ELSE 
>     NULL 
> END
> {code}
> will trigger runtime exception. 
> See following test sample for more details:
> https://github.com/walterddr/flink/commit/a5f2affc9bbbd50f06200f099c90597e519e9170



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

Reply via email to