Package org.apache.iceberg.avro
Class AvroSchemaUtil
- java.lang.Object
-
- org.apache.iceberg.avro.AvroSchemaUtil
-
public class AvroSchemaUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADJUST_TO_UTC_PROP
static java.lang.String
ELEMENT_ID_PROP
static java.lang.String
FIELD_ID_PROP
static java.lang.String
ICEBERG_FIELD_NAME_PROP
static java.lang.String
KEY_ID_PROP
static java.lang.String
VALUE_ID_PROP
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.apache.avro.Schema
applyNameMapping(org.apache.avro.Schema fileSchema, NameMapping nameMapping)
static org.apache.avro.Schema
buildAvroProjection(org.apache.avro.Schema schema, Schema expected, java.util.Map<java.lang.String,java.lang.String> renames)
static Type
convert(org.apache.avro.Schema schema)
static org.apache.avro.Schema
convert(Schema schema, java.lang.String tableName)
static org.apache.avro.Schema
convert(Schema schema, java.util.Map<Types.StructType,java.lang.String> names)
static org.apache.avro.Schema
convert(Type type)
static org.apache.avro.Schema
convert(Type type, java.util.function.BiFunction<java.lang.Integer,Types.StructType,java.lang.String> namesFunction)
static org.apache.avro.Schema
convert(Type type, java.util.Map<Types.StructType,java.lang.String> names)
static org.apache.avro.Schema
convert(Types.StructType type, java.lang.String name)
static java.util.Map<Type,org.apache.avro.Schema>
convertTypes(Types.StructType type, java.lang.String name)
static int
getElementId(org.apache.avro.Schema schema)
static int
getFieldId(org.apache.avro.Schema.Field field)
static int
getKeyId(org.apache.avro.Schema schema)
static int
getValueId(org.apache.avro.Schema schema)
static boolean
hasFieldId(org.apache.avro.Schema.Field field)
static boolean
isKeyValueSchema(org.apache.avro.Schema schema)
static boolean
isOptionSchema(org.apache.avro.Schema schema)
static boolean
isTimestamptz(org.apache.avro.Schema schema)
static java.lang.String
makeCompatibleName(java.lang.String name)
static org.apache.avro.Schema
pruneColumns(org.apache.avro.Schema schema, java.util.Set<java.lang.Integer> selectedIds)
static org.apache.avro.Schema
pruneColumns(org.apache.avro.Schema schema, java.util.Set<java.lang.Integer> selectedIds, NameMapping nameMapping)
Deprecated.will be removed in 2.0.0; use applyNameMapping and pruneColumns(Schema, Set) instead.static Schema
toIceberg(org.apache.avro.Schema schema)
-
-
-
Field Detail
-
ICEBERG_FIELD_NAME_PROP
public static final java.lang.String ICEBERG_FIELD_NAME_PROP
- See Also:
- Constant Field Values
-
FIELD_ID_PROP
public static final java.lang.String FIELD_ID_PROP
- See Also:
- Constant Field Values
-
KEY_ID_PROP
public static final java.lang.String KEY_ID_PROP
- See Also:
- Constant Field Values
-
VALUE_ID_PROP
public static final java.lang.String VALUE_ID_PROP
- See Also:
- Constant Field Values
-
ELEMENT_ID_PROP
public static final java.lang.String ELEMENT_ID_PROP
- See Also:
- Constant Field Values
-
ADJUST_TO_UTC_PROP
public static final java.lang.String ADJUST_TO_UTC_PROP
- See Also:
- Constant Field Values
-
-
Method Detail
-
convert
public static org.apache.avro.Schema convert(Schema schema, java.lang.String tableName)
-
convert
public static org.apache.avro.Schema convert(Schema schema, java.util.Map<Types.StructType,java.lang.String> names)
-
convert
public static org.apache.avro.Schema convert(Type type)
-
convert
public static org.apache.avro.Schema convert(Types.StructType type, java.lang.String name)
-
convert
public static org.apache.avro.Schema convert(Type type, java.util.Map<Types.StructType,java.lang.String> names)
-
convert
public static org.apache.avro.Schema convert(Type type, java.util.function.BiFunction<java.lang.Integer,Types.StructType,java.lang.String> namesFunction)
-
convert
public static Type convert(org.apache.avro.Schema schema)
-
toIceberg
public static Schema toIceberg(org.apache.avro.Schema schema)
-
convertTypes
public static java.util.Map<Type,org.apache.avro.Schema> convertTypes(Types.StructType type, java.lang.String name)
-
pruneColumns
public static org.apache.avro.Schema pruneColumns(org.apache.avro.Schema schema, java.util.Set<java.lang.Integer> selectedIds)
-
pruneColumns
@Deprecated public static org.apache.avro.Schema pruneColumns(org.apache.avro.Schema schema, java.util.Set<java.lang.Integer> selectedIds, NameMapping nameMapping)
Deprecated.will be removed in 2.0.0; use applyNameMapping and pruneColumns(Schema, Set) instead.
-
buildAvroProjection
public static org.apache.avro.Schema buildAvroProjection(org.apache.avro.Schema schema, Schema expected, java.util.Map<java.lang.String,java.lang.String> renames)
-
applyNameMapping
public static org.apache.avro.Schema applyNameMapping(org.apache.avro.Schema fileSchema, NameMapping nameMapping)
-
isTimestamptz
public static boolean isTimestamptz(org.apache.avro.Schema schema)
-
isOptionSchema
public static boolean isOptionSchema(org.apache.avro.Schema schema)
-
isKeyValueSchema
public static boolean isKeyValueSchema(org.apache.avro.Schema schema)
-
getKeyId
public static int getKeyId(org.apache.avro.Schema schema)
-
getValueId
public static int getValueId(org.apache.avro.Schema schema)
-
getElementId
public static int getElementId(org.apache.avro.Schema schema)
-
getFieldId
public static int getFieldId(org.apache.avro.Schema.Field field)
-
hasFieldId
public static boolean hasFieldId(org.apache.avro.Schema.Field field)
-
makeCompatibleName
public static java.lang.String makeCompatibleName(java.lang.String name)
-
-