Modifier and Type | Field and Description |
---|---|
static int |
MAX_COLUMN_WIDTH |
static String |
NULL_COLUMN |
static String |
ROW_KIND_COLUMN |
Modifier and Type | Method and Description |
---|---|
static int[] |
columnWidthsByType(List<Column> 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(ResolvedSchema resolvedSchema,
Iterator<Row> it,
PrintWriter printWriter,
int maxColumnWidth,
String nullColumn,
boolean deriveColumnWidthByType,
boolean printRowKind,
java.time.ZoneId sessionTimeZone)
Displays the result in a tableau form.
|
static void |
printAsTableauForm(ResolvedSchema resolvedSchema,
Iterator<Row> it,
PrintWriter printWriter,
java.time.ZoneId sessionTimeZone)
Displays the result in a tableau form.
|
static void |
printSingleRow(int[] colWidths,
String[] cols,
PrintWriter printWriter) |
static String[] |
rowToString(Row row,
ResolvedSchema resolvedSchema,
java.time.ZoneId sessionTimeZone) |
static String[] |
rowToString(Row row,
String nullColumn,
boolean printRowKind,
ResolvedSchema resolvedSchema,
java.time.ZoneId sessionTimeZone) |
public static final int MAX_COLUMN_WIDTH
public static final String NULL_COLUMN
public static final String ROW_KIND_COLUMN
public static void printAsTableauForm(ResolvedSchema resolvedSchema, Iterator<Row> it, PrintWriter printWriter, java.time.ZoneId sessionTimeZone)
For example:
+-------------+---------+-------------+ | boolean_col | int_col | varchar_col | +-------------+---------+-------------+ | true | 1 | abc | | false | 2 | def | | (NULL) | (NULL) | (NULL) | +-------------+---------+-------------+ 3 rows in set
public static void printAsTableauForm(ResolvedSchema resolvedSchema, Iterator<Row> it, PrintWriter printWriter, int maxColumnWidth, String nullColumn, boolean deriveColumnWidthByType, boolean printRowKind, java.time.ZoneId sessionTimeZone)
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: (printRowKind is true)
+----+-------------+---------+-------------+ | op | boolean_col | int_col | varchar_col | +----+-------------+---------+-------------+ | +I | true | 1 | abc | | -U | false | 2 | def | | +U | false | 3 | def | | -D | (NULL) | (NULL) | (NULL) | +----+-------------+---------+-------------+ 4 rows in set
resolvedSchema
- 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).printRowKind
- A flag to indicate whether print row kind infosessionTimeZone
- The time zone of current session.public static String[] rowToString(Row row, ResolvedSchema resolvedSchema, java.time.ZoneId sessionTimeZone)
public static String[] rowToString(Row row, String nullColumn, boolean printRowKind, ResolvedSchema resolvedSchema, java.time.ZoneId sessionTimeZone)
public static String genBorderLine(int[] colWidths)
public static int[] columnWidthsByType(List<Column> 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–2022 The Apache Software Foundation. All rights reserved.