matriv commented on a change in pull request #17811:
URL: https://github.com/apache/flink/pull/17811#discussion_r754869656



##########
File path: 
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sink/ConstraintEnforcer.java
##########
@@ -188,14 +201,13 @@ public void processElement(StreamRecord<RowData> element) 
throws Exception {
         for (int i = 0; i < charFieldIndices.length; i++) {
             final int fieldIdx = charFieldIndices[i];
             final int precision = charFieldPrecisions[i];
-            final String stringValue = rowData.getString(fieldIdx).toString();
+            final BinaryStringData stringData = (BinaryStringData) 
rowData.getString(fieldIdx);
 
-            if (stringValue.length() > precision) {
+            if (stringData.getJavaObject().length() > precision) {

Review comment:
       yep, `numChars()` seems to be the safe choice, thx!




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