dawidwys commented on a change in pull request #12649:
URL: https://github.com/apache/flink/pull/12649#discussion_r440894139



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeStrategies.java
##########
@@ -315,6 +317,36 @@ public static TypeStrategy nullable(TypeStrategy 
initialStrategy) {
                return Optional.of(fromLogicalToDataType(inferredType));
        };
 
+       /**
+        * Type strategy that returns a type of a field nested inside a 
composite type that is described by the second argument.
+        * The second argument must be a literal that describes either the 
nested field name or index.
+        */
+       public static final TypeStrategy GET = callContext -> {
+               List<DataType> argumentDataTypes = 
callContext.getArgumentDataTypes();
+               DataType rowDataType = argumentDataTypes.get(0);
+               TableSchema nestedSchema = 
DataTypeUtils.expandCompositeTypeToSchema(rowDataType);

Review comment:
       I think it does already support the `DISTINCT` type. Moreover 
`AtomicDataType` can not hold a composite type. `AtomicDataType` can not hold 
the bridging classes of nested fields. IMO `Distinct` type can be any of 
`FieldsDataType`, `AtomicDataType`, 'KeyValueDataType` etc.
   
   The way we support `DISTINCT` type is that we do not check the 
`LogicalTypeRoot` in `expandCompositeTypeToSchema`, but we check only for the 
`FieldsDataType`.




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


Reply via email to