public class AvroSchemaConverter extends Object
org.apache.flink.api.java.typeutils.RowTypeInfo for
representing objects and converts Avro types into types that are compatible with Flink's Table &
SQL API.
Note: Changes in this class need to be kept in sync with the corresponding runtime classes
org.apache.flink.formats.avro.AvroRowDeserializationSchema and org.apache.flink.formats.avro.AvroRowSerializationSchema.
NOTE: reference from Flink release 1.12.0, should remove when Flink version upgrade to that.
| Constructor and Description |
|---|
AvroSchemaConverter() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.flink.table.types.DataType |
convertToDataType(org.apache.avro.Schema schema)
Converts an Avro schema
schema into a nested row structure with deterministic field order and
data types that are compatible with Flink's Table & SQL API. |
static org.apache.avro.Schema |
convertToSchema(org.apache.flink.table.types.logical.LogicalType schema)
Converts Flink SQL
LogicalType (can be nested) into an Avro schema. |
static org.apache.avro.Schema |
convertToSchema(org.apache.flink.table.types.logical.LogicalType logicalType,
String rowName)
Converts Flink SQL
LogicalType (can be nested) into an Avro schema. |
static org.apache.flink.table.types.logical.LogicalType |
extractValueTypeToAvroMap(org.apache.flink.table.types.logical.LogicalType type) |
public static org.apache.flink.table.types.DataType convertToDataType(org.apache.avro.Schema schema)
schema into a nested row structure with deterministic field order and
data types that are compatible with Flink's Table & SQL API.schema - Avro schema definitionpublic static org.apache.avro.Schema convertToSchema(org.apache.flink.table.types.logical.LogicalType schema)
LogicalType (can be nested) into an Avro schema.
Use "record" as the type name.
schema - the schema type, usually it should be the top level record type, e.g. not a
nested typeSchema matching this logical type.public static org.apache.avro.Schema convertToSchema(org.apache.flink.table.types.logical.LogicalType logicalType,
String rowName)
LogicalType (can be nested) into an Avro schema.
The "{rowName}." is used as the nested row type name prefix in order to generate the right schema. Nested record type that only differs with type name is still compatible.
logicalType - logical typerowName - the record nameSchema matching this logical type.public static org.apache.flink.table.types.logical.LogicalType extractValueTypeToAvroMap(org.apache.flink.table.types.logical.LogicalType type)
Copyright © 2022 The Apache Software Foundation. All rights reserved.