slinkydeveloper commented on a change in pull request #18274:
URL: https://github.com/apache/flink/pull/18274#discussion_r780265171
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/utils/LogicalTypeDataTypeConverter.java
##########
@@ -201,9 +200,29 @@ public DataType visit(RowType rowType) {
@Override
public DataType visit(DistinctType distinctType) {
- return new FieldsDataType(
- distinctType,
-
Collections.singletonList(distinctType.getSourceType().accept(this)));
+ final DataType sourceDataType =
distinctType.getSourceType().accept(this);
+ if (sourceDataType instanceof AtomicDataType) {
+ return new AtomicDataType(distinctType,
sourceDataType.getConversionClass());
+ } else if (sourceDataType instanceof CollectionDataType) {
+ final CollectionDataType collectionDataType =
(CollectionDataType) sourceDataType;
+ return new CollectionDataType(
+ distinctType,
+ collectionDataType.getConversionClass(),
+ collectionDataType.getElementDataType());
+ } else if (sourceDataType instanceof KeyValueDataType) {
+ final KeyValueDataType keyValueDataType = (KeyValueDataType)
sourceDataType;
+ return new KeyValueDataType(
+ distinctType,
+ keyValueDataType.getConversionClass(),
+ keyValueDataType.getKeyDataType(),
+ keyValueDataType.getValueDataType());
+ } else if (sourceDataType instanceof FieldsDataType) {
+ return new FieldsDataType(
+ distinctType,
+ sourceDataType.getConversionClass(),
+ sourceDataType.getChildren());
+ }
+ throw new IllegalStateException("Unexpected data type instance.");
Review comment:
Ok, that's a detail I didn't knew about our type system, makes sense
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]