Suvrat1629 commented on code in PR #36059:
URL: https://github.com/apache/beam/pull/36059#discussion_r2338517299


##########
sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/TableSchema.java:
##########
@@ -335,8 +335,73 @@ public static Object parseDefaultExpression(ColumnType 
columnType, String value)
           return Long.valueOf(value);
         case UINT64:
           return Long.valueOf(value);
+        case ENUM8:
+        case ENUM16:
+        case FIXEDSTRING:
+        case STRING:
+          return value;
         case BOOL:
           return Boolean.valueOf(value);
+        case FLOAT32:
+          return Float.valueOf(value);
+        case FLOAT64:
+          return Double.valueOf(value);
+        case DATE:
+        case DATETIME:
+          // ClickHouse DateTime/Date format: 'YYYY-MM-DD HH:MM:SS' or 
'YYYY-MM-DD'
+          // Convert to Joda DateTime (used by Beam Schema.FieldType.DATETIME)
+          try {
+            String formattedValue = value.contains(" ") ? value : value + " 
00:00:00";
+            return new org.joda.time.DateTime(
+                java.time.LocalDateTime.parse(
+                        formattedValue,
+                        
java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+                    .atZone(java.time.ZoneId.of("UTC"))
+                    .toInstant()
+                    .toEpochMilli());

Review Comment:
   Done. PTAL.
   Thank you!



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