snuyanzin commented on code in PR #28125:
URL: https://github.com/apache/flink/pull/28125#discussion_r3208087376


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/BinaryToStringCastRule.java:
##########
@@ -48,6 +56,18 @@ private BinaryToStringCastRule() {
 
     /* Example generated code
 
+    --- Strict UTF-8 mode fast path: STRING / VARCHAR(MAX) target. No String 
allocation, no re-encoding.
+    isNull$0 = _myInputIsNull;
+    if (!isNull$0) {
+        result$1 = 
org.apache.flink.table.data.binary.BinaryStringData.fromUtf8Bytes(_myInput);
+        isNull$0 = result$1 == null;
+    } else {
+        result$1 = 
org.apache.flink.table.data.binary.BinaryStringData.EMPTY_UTF8;
+    }
+
+    --- Round-trip path: legacy mode (silent U+FFFD substitution) or strict 
UTF-8 mode + CHAR(n)/VARCHAR(n) (trim/pad).
+    --- The decode line below is the legacy variant; in strict UTF-8 mode it 
becomes:
+    ---     resultString$435 = 
org.apache.flink.table.data.binary.BinaryStringData.fromUtf8Bytes(_myInput).toString();

Review Comment:
   ```suggestion
       ---     resultString$0 = 
org.apache.flink.table.data.binary.BinaryStringData.fromUtf8Bytes(_myInput).toString();
   ```
   nit: just simplify the example



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