yuxiqian commented on code in PR #3357:
URL: https://github.com/apache/flink-cdc/pull/3357#discussion_r1612544048


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java:
##########
@@ -298,4 +312,33 @@ private static Java.Rvalue 
generateNoOperandTimestampFunctionOperation(String op
                 StringUtils.convertToCamelCase(operationName),
                 timestampFunctionParam.toArray(new Java.Rvalue[0]));
     }
+
+    private static String getTypeConvertMethod(SqlDataTypeSpec 
sqlDataTypeSpec) {
+        switch (sqlDataTypeSpec.getTypeName().getSimple().toUpperCase()) {
+            case "BOOLEAN":
+                return "convertBoolean";
+            case "TINYINT":
+                return "convertByte";
+            case "SMALLINT":
+                return "convertShort";
+            case "INTEGER":
+                return "convertInteger";
+            case "BIGINT":
+                return "convertLong";
+            case "FLOAT":
+                return "convertFloat";
+            case "DOUBLE":
+                return "convertDouble";
+            case "DECIMAL":
+                return "convertBigDecimal";
+            case "CHAR":
+            case "VARCHAR":
+            case "STRING":
+            case "`STRING`":
+                return "convertString";
+            default:
+                throw new ParseException(
+                        "Unsupported data type convert: " + 
sqlDataTypeSpec.toString());

Review Comment:
   ```suggestion
                   throw new ParseException(
                           "Unsupported data type cast: " + 
sqlDataTypeSpec.toString());
   ```
   
   Using cast might be better since user writes `cast` keyword instead of 
`convert` in YAML



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