You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lvyanquan (via GitHub)" <gi...@apache.org> on 2025/08/07 06:39:56 UTC

Re: [PR] [FLINK-37905] Fix transform failure with non-ascii string literals [flink-cdc]

lvyanquan commented on code in PR #4038:
URL: https://github.com/apache/flink-cdc/pull/4038#discussion_r2259236555


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java:
##########
@@ -158,10 +159,10 @@ private static Java.Rvalue translateSqlSqlLiteral(SqlLiteral sqlLiteral) {
         if (sqlLiteral.getValue() == null) {
             return new Java.NullLiteral(Location.NOWHERE);
         }
-        String value = sqlLiteral.getValue().toString();
+        Object value = sqlLiteral.getValue();
         if (sqlLiteral instanceof SqlCharStringLiteral) {
             // Double quotation marks represent strings in Janino.
-            value = "\"" + value.substring(1, value.length() - 1) + "\"";
+            value = "\"" + ((NlsString) value).getValue() + "\"";

Review Comment:
   value = "\"" + ((SqlCharStringLiteral) sqlLiteral).getValueAs(NlsString.class).getValue() + "\"";



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org