xiaochen-zhou commented on code in PR #6767:
URL: https://github.com/apache/seatunnel/pull/6767#discussion_r1606681878


##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowTypeConverter.java:
##########
@@ -234,22 +248,57 @@ private static class SeaTunnelTypeToPaimonVisitor {
 
         private SeaTunnelTypeToPaimonVisitor() {}
 
-        public DataType visit(Column column) {
+        public BasicTypeDefine<DataType> visit(Column column) {
+            BasicTypeDefine.BasicTypeDefineBuilder<DataType> builder =
+                    BasicTypeDefine.<DataType>builder()
+                            .name(column.getName())
+                            .nullable(column.isNullable())
+                            .comment(column.getComment())
+                            .defaultValue(column.getDefaultValue());
             SeaTunnelDataType<?> dataType = column.getDataType();
             Integer scale = column.getScale();
             switch (dataType.getSqlType()) {
                 case TIMESTAMP:
-                    return DataTypes.TIMESTAMP(
-                            Objects.isNull(scale) ? 
TimestampType.DEFAULT_PRECISION : scale);
+                    int timestampScale =
+                            Objects.isNull(scale) ? 
TimestampType.DEFAULT_PRECISION : scale;
+                    TimestampType timestampType = 
DataTypes.TIMESTAMP(timestampScale);
+                    builder.nativeType(timestampType);
+                    builder.dataType(timestampType.getTypeRoot().name());
+                    builder.columnType(timestampType.toString());
+                    builder.scale(timestampScale);
+                    builder.length(column.getColumnLength());
+                    return builder.build();
                 case TIME:
-                    return DataTypes.TIME(
-                            Objects.isNull(scale) ? TimeType.DEFAULT_PRECISION 
: scale);
+                    int timeScale = Objects.isNull(scale) ? 
TimeType.DEFAULT_PRECISION : scale;
+                    TimeType timeType = DataTypes.TIME(timeScale);
+                    builder.nativeType(timeType);
+                    builder.columnType(timeType.toString());
+                    builder.dataType(timeType.getTypeRoot().name());
+                    builder.scale(timeScale);
+                    builder.length(column.getColumnLength());
+                    return builder.build();
+                case DECIMAL:
+                    int precision =

Review Comment:
   > In some cases, the `precision` and `scale` obtained here may be 0, and you 
must handle this situation to achieve better compatibility.
   
   done.



##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/utils/RowTypeConverter.java:
##########
@@ -445,9 +496,8 @@ public SeaTunnelDataType<?> visit(RowType rowType) {
 
         @Override
         protected SeaTunnelDataType defaultMethod(DataType dataType) {

Review Comment:
   > Please put fieldname as `UNKNOWN`.
   
   done.



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

Reply via email to