zhongqishang commented on code in PR #3130:
URL: https://github.com/apache/flink-cdc/pull/3130#discussion_r1544155132


##########
flink-cdc-common/src/main/java/org/apache/flink/cdc/common/types/utils/DataTypeUtils.java:
##########
@@ -134,8 +136,27 @@ public static org.apache.flink.table.types.DataType 
toFlinkDataType(DataType typ
                         toFlinkDataType(children.get(0)), 
toFlinkDataType(children.get(1)));
             case ROW:
                 
Preconditions.checkState(!CollectionUtil.isNullOrEmpty(children));
-                return org.apache.flink.table.api.DataTypes.ROW(
-                        children.toArray(new 
org.apache.flink.table.types.DataType[] {}));
+                RowType rowType = (RowType) type;
+                List<org.apache.flink.table.api.DataTypes.Field> fields =
+                        rowType.getFields().stream()
+                                .map(
+                                        dataField ->
+                                                dataField.getDescription() == 
null
+                                                        ? 
org.apache.flink.table.api.DataTypes
+                                                                .FIELD(
+                                                                        
dataField.getName(),
+                                                                        
toFlinkDataType(
+                                                                               
 dataField
+                                                                               
         .getType()))
+                                                        : 
org.apache.flink.table.api.DataTypes
+                                                                .FIELD(
+                                                                        
dataField.getName(),
+                                                                        
toFlinkDataType(
+                                                                               
 dataField
+                                                                               
         .getType()),
+                                                                        
dataField.getDescription()))
+                                .collect(Collectors.toList());

Review Comment:
   Add a named `toFlinkDataTypeField` method.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to