yzeng1618 commented on code in PR #9743:
URL: https://github.com/apache/seatunnel/pull/9743#discussion_r2377803240


##########
seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveTypeConvertor.java:
##########
@@ -56,4 +57,53 @@ public static SeaTunnelDataType<?> 
covertHiveTypeToSeaTunnelType(String name, St
         }
         return 
SeaTunnelDataTypeConvertorUtil.deserializeSeaTunnelDataType(name, hiveType);
     }
+
+    public static String seatunnelToHiveType(SeaTunnelDataType<?> 
seaTunnelType) {
+        switch (seaTunnelType.getSqlType()) {
+            case STRING:
+                return "string";
+            case BOOLEAN:
+                return "boolean";
+            case TINYINT:
+                return "tinyint";
+            case SMALLINT:
+                return "smallint";
+            case INT:
+                return "int";
+            case BIGINT:
+                return "bigint";
+            case FLOAT:
+                return "float";
+            case DOUBLE:
+                return "double";
+            case DECIMAL:
+                if (seaTunnelType instanceof DecimalType) {
+                    DecimalType decimalType = (DecimalType) seaTunnelType;
+                    return String.format(
+                            "decimal(%d,%d)", decimalType.getPrecision(), 
decimalType.getScale());
+                }
+                return "decimal(38,18)";
+            case BYTES:
+                return "binary";
+            case DATE:
+                return "date";
+            case TIME:
+                return "string";
+            case TIMESTAMP:
+                return "timestamp";
+            case ROW:
+                return "struct";
+            case ARRAY:
+                return "array";

Review Comment:
   Added and modified.



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