Modifier and Type | Field and Description |
---|---|
static int |
MAX_COLUMN_WIDTH |
static String |
NULL_COLUMN |
Modifier and Type | Method and Description |
---|---|
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<Row> it,
PrintWriter printWriter)
Displays the result in a tableau form.
|
static void |
printAsTableauForm(TableSchema tableSchema,
Iterator<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(Row row) |
static String[] |
rowToString(Row row,
String nullColumn) |
public static final int MAX_COLUMN_WIDTH
public static final String NULL_COLUMN
public static void printAsTableauForm(TableSchema tableSchema, Iterator<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<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 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–2021 The Apache Software Foundation. All rights reserved.