@Internal public class PrintUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
MAX_COLUMN_WIDTH |
static String |
NULL_COLUMN |
| 限定符和类型 | 方法和说明 |
|---|---|
static int[] |
columnWidthsByType(List<TableColumn> columns,
int maxColumnWidth,
String nullColumn,
String rowKindColumn)
Try to derive column width based on column types.
|
static String |
genBorderLine(int[] colWidths) |
static int |
getStringDisplayWidth(String str) |
static boolean |
isFullWidth(int codePoint)
Check codePoint is FullWidth or not according to Unicode Standard version 12.0.0.
|
static void |
printAsTableauForm(TableSchema tableSchema,
Iterator<org.apache.flink.types.Row> it,
PrintWriter printWriter)
Displays the result in a tableau form.
|
static void |
printAsTableauForm(TableSchema tableSchema,
Iterator<org.apache.flink.types.Row> it,
PrintWriter printWriter,
int maxColumnWidth,
String nullColumn,
boolean deriveColumnWidthByType)
Displays the result in a tableau form.
|
static void |
printSingleRow(int[] colWidths,
String[] cols,
PrintWriter printWriter) |
static String[] |
rowToString(org.apache.flink.types.Row row) |
static String[] |
rowToString(org.apache.flink.types.Row row,
String nullColumn) |
public static final int MAX_COLUMN_WIDTH
public static void printAsTableauForm(TableSchema tableSchema, Iterator<org.apache.flink.types.Row> it, PrintWriter printWriter)
For example: +-------------+---------+-------------+ | boolean_col | int_col | varchar_col | +-------------+---------+-------------+ | true | 1 | abc | | false | 2 | def | | (NULL) | (NULL) | (NULL) | +-------------+---------+-------------+ 3 rows in result
Changelog is not supported until FLINK-16998 is finished.
public static void printAsTableauForm(TableSchema tableSchema, Iterator<org.apache.flink.types.Row> it, PrintWriter printWriter, int maxColumnWidth, String nullColumn, boolean deriveColumnWidthByType)
NOTE: please make sure the data to print is small enough to be stored in java heap memory if the column width is derived from content (`deriveColumnWidthByType` is false).
For example:
+-------------+---------+-------------+ | boolean_col | int_col | varchar_col | +-------------+---------+-------------+ | true | 1 | abc | | false | 2 | def | | (NULL) | (NULL) | (NULL) | +-------------+---------+-------------+
tableSchema - The schema of the data to printit - The iterator for the data to printprintWriter - The writer to write tomaxColumnWidth - The max width of a columnnullColumn - The string representation of a null valuederiveColumnWidthByType - A flag to indicate whether the column width
is derived from type (true) or content (false).public static String[] rowToString(org.apache.flink.types.Row row)
public static String genBorderLine(int[] colWidths)
public static int[] columnWidthsByType(List<TableColumn> columns, int maxColumnWidth, String nullColumn, @Nullable String rowKindColumn)
public static void printSingleRow(int[] colWidths,
String[] cols,
PrintWriter printWriter)
public static int getStringDisplayWidth(String str)
public static boolean isFullWidth(int codePoint)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.