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...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to