public final class HiveSchemaUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static org.apache.iceberg.Schema |
convert(java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas)
Converts a Hive schema (list of FieldSchema objects) to an Iceberg schema.
|
static org.apache.iceberg.Schema |
convert(java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas,
boolean autoConvert)
Converts a Hive schema (list of FieldSchema objects) to an Iceberg schema.
|
static org.apache.iceberg.Schema |
convert(java.util.List<java.lang.String> names,
java.util.List<org.apache.hadoop.hive.serde2.typeinfo.TypeInfo> types,
java.util.List<java.lang.String> comments)
Converts the Hive list of column names and column types to an Iceberg schema.
|
static org.apache.iceberg.Schema |
convert(java.util.List<java.lang.String> names,
java.util.List<org.apache.hadoop.hive.serde2.typeinfo.TypeInfo> types,
java.util.List<java.lang.String> comments,
boolean autoConvert)
Converts the Hive list of column names and column types to an Iceberg schema.
|
static java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> |
convert(org.apache.iceberg.Schema schema)
Converts the Iceberg schema to a Hive schema (list of FieldSchema objects).
|
static org.apache.hadoop.hive.serde2.typeinfo.TypeInfo |
convert(org.apache.iceberg.types.Type type)
Converts an Iceberg type to a Hive TypeInfo object.
|
static org.apache.iceberg.types.Type |
convert(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo typeInfo)
Converts a Hive typeInfo object to an Iceberg type.
|
static org.apache.iceberg.PartitionSpec |
spec(org.apache.iceberg.Schema schema,
java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas)
Converts the Hive partition columns to Iceberg identity partition specification.
|
public static java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> convert(org.apache.iceberg.Schema schema)
schema - The original Iceberg schema to convertpublic static org.apache.iceberg.Schema convert(java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas)
fieldSchemas - The list of the columnspublic static org.apache.iceberg.Schema convert(java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas,
boolean autoConvert)
fieldSchemas - The list of the columnsautoConvert - If true then TINYINT and SMALLINT is converted to INTEGER and
VARCHAR and CHAR is converted to STRING. Otherwise if these types are used in the Hive
schema then exception is thrown.public static org.apache.iceberg.PartitionSpec spec(org.apache.iceberg.Schema schema,
java.util.List<org.apache.hadoop.hive.metastore.api.FieldSchema> fieldSchemas)
schema - The Iceberg schemafieldSchemas - The partition column specificationpublic static org.apache.iceberg.Schema convert(java.util.List<java.lang.String> names,
java.util.List<org.apache.hadoop.hive.serde2.typeinfo.TypeInfo> types,
java.util.List<java.lang.String> comments)
names - The list of the Hive column namestypes - The list of the Hive column typescomments - The list of the Hive column commentspublic static org.apache.iceberg.Schema convert(java.util.List<java.lang.String> names,
java.util.List<org.apache.hadoop.hive.serde2.typeinfo.TypeInfo> types,
java.util.List<java.lang.String> comments,
boolean autoConvert)
names - The list of the Hive column namestypes - The list of the Hive column typescomments - The list of the Hive column comments, can be nullautoConvert - If true then TINYINT and SMALLINT is converted to INTEGER and
VARCHAR and CHAR is converted to STRING. Otherwise if these types are used in the Hive
schema then exception is thrown.public static org.apache.hadoop.hive.serde2.typeinfo.TypeInfo convert(org.apache.iceberg.types.Type type)
type - The Iceberg typepublic static org.apache.iceberg.types.Type convert(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo typeInfo)
typeInfo - The Hive type