KurtYoung commented on a change in pull request #11334: 
[FLINK-16464][sql-client]result-mode tableau may shift when content contains 
Chinese String in SQL CLI
URL: https://github.com/apache/flink/pull/11334#discussion_r390076434
 
 

 ##########
 File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliTableauResultView.java
 ##########
 @@ -276,13 +277,13 @@ private void printSingleRow(int[] colWidths, String[] 
cols) {
                sb.append("|");
                int idx = 0;
                for (String col : cols) {
-                       byte[] colBytes = getUTF8Bytes(col);
                        sb.append(" ");
-                       if (colBytes.length <= colWidths[idx]) {
-                               sb.append(StringUtils.repeat(' ', 
colWidths[idx] - colBytes.length));
+                       int colWidth = getStringWidth(col);
+                       if (colWidth <= colWidths[idx]) {
+                               sb.append(StringUtils.repeat(' ', 
colWidths[idx] - colWidth));
                                sb.append(col);
                        } else {
-                               sb.append(subMaxString(col, colWidths[idx]));
+                               sb.append(getFixedString(col, colWidths[idx]));
 
 Review comment:
   `getFixedString` => `truncateString`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to