suhwan-cheon commented on code in PR #4277:
URL: https://github.com/apache/flink-cdc/pull/4277#discussion_r2850128392


##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-iceberg/src/main/java/org/apache/flink/cdc/connectors/iceberg/sink/utils/IcebergTypeUtils.java:
##########
@@ -53,6 +60,66 @@ public static Types.NestedField 
convertCdcColumnToIcebergField(
                 column.getComment());
     }
 
+    /**
+     * Parse a CDC default value expression string into an Iceberg {@link 
Literal}.
+     *
+     * @return the parsed Literal, or null if the expression is null or cannot 
be parsed for the
+     *     given type.
+     */
+    @Nullable
+    public static Literal<?> parseDefaultValue(
+            @Nullable String defaultValueExpression, DataType cdcType) {
+        if (defaultValueExpression == null) {
+            return null;
+        }
+        try {
+            switch (cdcType.getTypeRoot()) {
+                case CHAR:
+                case VARCHAR:
+                    return Literal.of(defaultValueExpression);
+                case BOOLEAN:

Review Comment:
   I think this normalization (e.g., 'active'::varchar) is the responsibility 
of the source connector, not the sink.



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