KurtYoung commented on a change in pull request #8179: [FLINK-12200] 
[Table-planner] Support UNNEST for MAP types
URL: https://github.com/apache/flink/pull/8179#discussion_r278374663
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/rules/logical/LogicalUnnestRule.scala
 ##########
 @@ -94,6 +95,17 @@ class LogicalUnnestRule(
             case arrayType: ArrayRelDataType =>
               (arrayType.getComponentType,
                 
ExplodeFunctionUtil.explodeTableFuncFromType(arrayType.typeInfo))
+
+            case map: MapRelDataType =>
+              val keyTypeInfo = FlinkTypeFactory.toTypeInfo(map.keyType)
+              val valueTypeInfo = FlinkTypeFactory.toTypeInfo(map.valueType)
+              val componentTypeInfo = 
createTuple2TypeInformation(keyTypeInfo,valueTypeInfo)
 
 Review comment:
   I checked other system's behavior, it seems more common to unnest map field 
into two columns, in your case, it would be:
   
   `SELECT k, v FROM t1 , UNNEST(t1.c) as (k,v)`
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to