public final class ShowUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ShowUtils.TextMetaDataTable
Helps to format tables in SHOW ...
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGNMENT |
static int |
DEFAULT_STRINGBUILDER_SIZE |
static String |
FIELD_DELIM |
static String |
LINE_DELIM |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendNonNull(StringBuilder builder,
Object value) |
static void |
appendNonNull(StringBuilder builder,
Object value,
boolean firstColumn) |
static void |
asJson(OutputStream out,
Map<String,Object> data)
Convert the map to a JSON string.
|
static String |
convertToString(org.apache.hadoop.hive.metastore.api.Date val) |
static String |
convertToString(org.apache.hadoop.hive.metastore.api.Decimal val) |
static String |
convertToString(org.apache.hadoop.hive.metastore.api.Timestamp val) |
static String[] |
extractColumnValues(org.apache.hadoop.hive.metastore.api.FieldSchema column,
boolean isColumnStatsAvailable,
org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj columnStatisticsObj) |
static void |
formatOutput(String[] fields,
StringBuilder tableInfo)
Prints a row the given fields to a formatted line.
|
static void |
formatOutput(String[] fields,
StringBuilder tableInfo,
boolean isLastLinePadded,
boolean isFormatted)
Prints a row with the given fields into the builder.
|
static void |
formatOutput(String name,
String value,
StringBuilder tableInfo)
Prints the name value pair, and if the value contains newlines, it adds one more empty field
before the two values (Assumes, the name value pair is already indented with it).
|
static void |
formatOutput(String name,
String value,
StringBuilder tableInfo,
boolean isOutputPadded)
Prints the name value pair
If the output is padded then unescape the value, so it could be printed in multiple lines.
|
static DataOutputStream |
getOutputStream(org.apache.hadoop.fs.Path outputFile,
DDLOperationContext context) |
static String |
propertiesToString(Map<String,String> properties,
Set<String> exclude)
Creates a String from the properties in this format:
'property_name1'='property_value1',
'property_name2'='property_value2',
...
|
static void |
writeToFile(String data,
String file,
DDLOperationContext context) |
public static final String FIELD_DELIM
public static final String LINE_DELIM
public static final int DEFAULT_STRINGBUILDER_SIZE
public static final int ALIGNMENT
public static DataOutputStream getOutputStream(org.apache.hadoop.fs.Path outputFile, DDLOperationContext context) throws HiveException
HiveExceptionpublic static String propertiesToString(Map<String,String> properties, Set<String> exclude)
properties - The properties to list.exclude - Property names to exclude.public static void writeToFile(String data, String file, DDLOperationContext context) throws IOException
IOExceptionpublic static void appendNonNull(StringBuilder builder, Object value)
public static void appendNonNull(StringBuilder builder, Object value, boolean firstColumn)
public static String[] extractColumnValues(org.apache.hadoop.hive.metastore.api.FieldSchema column, boolean isColumnStatsAvailable, org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj columnStatisticsObj)
public static String convertToString(org.apache.hadoop.hive.metastore.api.Decimal val)
public static String convertToString(org.apache.hadoop.hive.metastore.api.Date val)
public static String convertToString(org.apache.hadoop.hive.metastore.api.Timestamp val)
public static void asJson(OutputStream out, Map<String,Object> data) throws HiveException
HiveExceptionpublic static void formatOutput(String[] fields, StringBuilder tableInfo, boolean isLastLinePadded, boolean isFormatted)
fields - The fields to printtableInfo - The target builderisLastLinePadded - Is the last field could be printed in multiple lines, if contains newlines?public static void formatOutput(String[] fields, StringBuilder tableInfo)
fields - The fields to printtableInfo - The target builderpublic static void formatOutput(String name, String value, StringBuilder tableInfo)
name - The field name to printvalue - The value to print - might contain newlinestableInfo - The target builderpublic static void formatOutput(String name, String value, StringBuilder tableInfo, boolean isOutputPadded)
name - The field name to printvalue - The value t printtableInfo - The target builderisOutputPadded - Should the value printed as a padded string?Copyright © 2022 The Apache Software Foundation. All rights reserved.