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

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

Github user haohui commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3338#discussion_r102125031
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/ExpressionReductionTest.scala
 ---
    @@ -155,15 +155,15 @@ class ExpressionReductionTest extends TableTestBase {
           "DataSetCalc",
           batchTableNode(0),
           term("select",
    -        "13 AS _c0",
    +        "CAST(13) AS _c0",
    --- End diff --
    
    Just played around a little bit. I think the problem is that the advanced 
types are not properly canonized. Using the following diff can pass all tests 
in `ArrayTypeTest`:
    
    ```
    --- 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkTypeFactory.scala
    +++ 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkTypeFactory.scala
    @@ -133,12 +133,18 @@ class FlinkTypeFactory(typeSystem: RelDataTypeSystem) 
extends JavaTypeFactoryImp
       override def createTypeWithNullability(
         relDataType: RelDataType,
         nullable: Boolean)
    -  : RelDataType = relDataType match {
    -    case composite: CompositeRelDataType =>
    -      // at the moment we do not care about nullability
    -      composite
    -    case _ =>
    -      super.createTypeWithNullability(relDataType, nullable)
    +  : RelDataType = {
    +    val t = relDataType match {
    +      case composite: CompositeRelDataType =>
    +        // at the moment we do not care about nullability
    +        composite
    +      case array: ArrayRelDataType =>
    +        val elementType = 
canonize(createTypeWithNullability(array.getComponentType, nullable))
    +        new ArrayRelDataType(array.typeInfo, elementType, nullable)
    +      case _ =>
    +        super.createTypeWithNullability(relDataType, nullable)
    +    }
    +    canonize(t)
       }
     }
    ```
    
    GroupWindowTest is still failing as it misses an identity projection. I'm 
wondering why `ProjectRemoveRule.INSTANCE` did not kick in...


> Bump up Calcite version to 1.11
> -------------------------------
>
>                 Key: FLINK-5414
>                 URL: https://issues.apache.org/jira/browse/FLINK-5414
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Jark Wu
>
> The upcoming Calcite release 1.11 has a lot of stability fixes and new 
> features. We should update it for the Table API.
> E.g. we can hopefully merge FLINK-4864



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to