public class AvroSchemaUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.apache.avro.Schema |
appendFieldsToSchema(org.apache.avro.Schema schema,
List<org.apache.avro.Schema.Field> newFields)
Appends provided new fields at the end of the given schema
NOTE: No deduplication is made, this method simply appends fields at the end of the list
of the source schema as is
|
static boolean |
containsFieldInSchema(org.apache.avro.Schema schema,
String fieldName)
Returns true in case when schema contains the field w/ provided name
|
static org.apache.avro.Schema |
createNullableSchema(org.apache.avro.Schema.Type avroType)
Creates schema following Avro's typical nullable schema definition:
Union(Schema.Type.NULL, <NonNullType>),
wrapping around provided target non-null type |
static boolean |
isNullable(org.apache.avro.Schema schema)
Returns true in case provided
Schema is nullable (ie accepting null values),
returns false otherwise |
static org.apache.avro.Schema |
resolveNullableSchema(org.apache.avro.Schema schema)
Resolves typical Avro's nullable schema definition:
Union(Schema.Type.NULL, <NonNullType>),
decomposing union and returning the target non-null type |
static org.apache.avro.Schema |
resolveUnionSchema(org.apache.avro.Schema schema,
String fieldSchemaFullName)
Passed in
Union schema and will try to resolve the field with the fieldSchemaFullName
w/in the union returning its corresponding schema |
public static org.apache.avro.Schema appendFieldsToSchema(org.apache.avro.Schema schema,
List<org.apache.avro.Schema.Field> newFields)
public static org.apache.avro.Schema resolveUnionSchema(org.apache.avro.Schema schema,
String fieldSchemaFullName)
Union schema and will try to resolve the field with the fieldSchemaFullName
w/in the union returning its corresponding schemaschema - target schema to be inspectedfieldSchemaFullName - target field-name to be looked up w/in the unionfieldSchemaFullNamepublic static boolean isNullable(org.apache.avro.Schema schema)
Schema is nullable (ie accepting null values),
returns false otherwisepublic static org.apache.avro.Schema resolveNullableSchema(org.apache.avro.Schema schema)
Union(Schema.Type.NULL, <NonNullType>),
decomposing union and returning the target non-null typepublic static org.apache.avro.Schema createNullableSchema(org.apache.avro.Schema.Type avroType)
Union(Schema.Type.NULL, <NonNullType>),
wrapping around provided target non-null typepublic static boolean containsFieldInSchema(org.apache.avro.Schema schema,
String fieldName)
Copyright © 2022 The Apache Software Foundation. All rights reserved.