public class AvroSchemaConverter extends Object
Modifier and Type | Method and Description |
---|---|
static org.apache.avro.Schema |
convertToSchema(DataType schema,
Map<String,String> rowNameMapping)
Converts Paimon
DataType (can be nested) into an Avro schema. |
static org.apache.avro.Schema |
convertToSchema(DataType dataType,
String rowName,
Map<String,String> rowNameMapping)
Converts Paimon
DataType (can be nested) into an Avro schema. |
static DataType |
extractKeyTypeToAvroMap(DataType type) |
static DataType |
extractValueTypeToAvroMap(DataType type) |
static boolean |
isArrayMap(DataType type) |
public static org.apache.avro.Schema convertToSchema(DataType schema, Map<String,String> rowNameMapping)
DataType
(can be nested) into an Avro schema.
Use "org.apache.paimon.avro.generated.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(DataType dataType, String rowName, Map<String,String> rowNameMapping)
DataType
(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.
dataType
- logical typerowName
- the record nameSchema
matching this logical type.public static boolean isArrayMap(DataType type)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.