Package org.apache.iceberg.flink
Class FlinkSchemaUtil
- java.lang.Object
 - 
- org.apache.iceberg.flink.FlinkSchemaUtil
 
 
- 
public class FlinkSchemaUtil extends java.lang.ObjectConverter between Flink types and Iceberg type. The conversion is not a 1:1 mapping that not allows back-and-forth conversion. So some information might get lost during the back-and-forth conversion.This inconsistent types:
- map Iceberg UUID type to Flink BinaryType(16)
 - map Flink VarCharType(_) and CharType(_) to Iceberg String type
 - map Flink VarBinaryType(_) to Iceberg Binary type
 - map Flink TimeType(_) to Iceberg Time type (microseconds)
 - map Flink TimestampType(_) to Iceberg Timestamp without zone type (microseconds)
 - map Flink LocalZonedTimestampType(_) to Iceberg Timestamp with zone type (microseconds)
 - map Flink MultiSetType to Iceberg Map type(element, int)
 
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Schemaconvert(org.apache.flink.table.api.TableSchema schema)Convert the flink table schema to apache iceberg schema.static Typeconvert(org.apache.flink.table.types.logical.LogicalType flinkType)Convert aFlink typeto aType.static org.apache.flink.table.types.logical.RowTypeconvert(Schema schema)Convert aSchemato aFlink type.static Schemaconvert(Schema baseSchema, org.apache.flink.table.api.TableSchema flinkSchema)Convert a FlinkTableSchemato aSchemabased on the given schema.static org.apache.flink.table.types.logical.LogicalTypeconvert(Type type)Convert aTypeto aFlink type.static org.apache.flink.table.api.TableSchematoSchema(org.apache.flink.table.types.logical.RowType rowType)Convert aRowTypeto aTableSchema.static org.apache.flink.table.api.TableSchematoSchema(Schema schema)Convert aSchemato aTableSchema. 
 - 
 
- 
- 
Method Detail
- 
convert
public static Schema convert(org.apache.flink.table.api.TableSchema schema)
Convert the flink table schema to apache iceberg schema. 
- 
convert
public static Schema convert(Schema baseSchema, org.apache.flink.table.api.TableSchema flinkSchema)
Convert a FlinkTableSchemato aSchemabased on the given schema.This conversion does not assign new ids; it uses ids from the base schema.
Data types, field order, and nullability will match the Flink type. This conversion may return a schema that is not compatible with base schema.
- Parameters:
 baseSchema- a Schema on which conversion is basedflinkSchema- a Flink TableSchema- Returns:
 - the equivalent Schema
 - Throws:
 java.lang.IllegalArgumentException- if the type cannot be converted or there are missing ids
 
- 
convert
public static org.apache.flink.table.types.logical.RowType convert(Schema schema)
Convert aSchemato aFlink type.- Parameters:
 schema- a Schema- Returns:
 - the equivalent Flink type
 - Throws:
 java.lang.IllegalArgumentException- if the type cannot be converted to Flink
 
- 
convert
public static org.apache.flink.table.types.logical.LogicalType convert(Type type)
Convert aTypeto aFlink type.- Parameters:
 type- a Type- Returns:
 - the equivalent Flink type
 - Throws:
 java.lang.IllegalArgumentException- if the type cannot be converted to Flink
 
- 
convert
public static Type convert(org.apache.flink.table.types.logical.LogicalType flinkType)
Convert aFlink typeto aType.- Parameters:
 flinkType- a FlinkType- Returns:
 - the equivalent Iceberg type
 
 
- 
toSchema
public static org.apache.flink.table.api.TableSchema toSchema(org.apache.flink.table.types.logical.RowType rowType)
Convert aRowTypeto aTableSchema.- Parameters:
 rowType- a RowType- Returns:
 - Flink TableSchema
 
 
 - 
 
 -