public class Schemas extends Object
| Constructor and Description |
|---|
Schemas() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.avro.Schema.Field |
copy(org.apache.avro.Schema.Field field)
Creates a new field with the same name, schema, doc, and default value as
the incoming schema.
|
static org.apache.avro.Schema |
fromAvro(InputStream in) |
static org.apache.avro.Schema |
fromAvsc(InputStream in) |
static org.apache.avro.Schema |
fromJSON(String name,
InputStream in) |
static org.apache.avro.Schema |
fromParquet(org.apache.hadoop.conf.Configuration conf,
URI location) |
static org.apache.avro.Schema |
merge(Iterable<org.apache.avro.Schema> schemas)
Merges
Schema instances if they are compatible. |
static org.apache.avro.Schema |
merge(org.apache.avro.Schema left,
org.apache.avro.Schema right)
Merges two
Schema instances if they are compatible. |
static org.apache.avro.Schema |
mergeOrUnion(Iterable<org.apache.avro.Schema> schemas)
Merges
Schema instances and creates a union of schemas if any are
incompatible. |
static boolean |
nullOk(org.apache.avro.Schema schema)
Returns whether null is allowed by the schema.
|
public static org.apache.avro.Schema fromAvsc(InputStream in) throws IOException
IOExceptionpublic static org.apache.avro.Schema fromAvro(InputStream in) throws IOException
IOExceptionpublic static org.apache.avro.Schema fromParquet(org.apache.hadoop.conf.Configuration conf,
URI location)
throws IOException
IOExceptionpublic static org.apache.avro.Schema fromJSON(String name, InputStream in) throws IOException
IOExceptionpublic static boolean nullOk(org.apache.avro.Schema schema)
schema - a Schemapublic static org.apache.avro.Schema merge(Iterable<org.apache.avro.Schema> schemas)
Schema instances if they are compatible.
Schemas are incompatible if:
Schema.Type does not match.Map value, array element, and record field types types will use unions if necessary, and union schemas are merged recursively.
schemas - a set of Schema instances to mergeSchemaIllegalStateException - if the schemas are not compatiblepublic static org.apache.avro.Schema mergeOrUnion(Iterable<org.apache.avro.Schema> schemas)
Schema instances and creates a union of schemas if any are
incompatible.
Schemas are incompatible if:
Schema.Type does not match.Map value, array element, and record field types types will use unions if necessary, and union schemas are merged recursively.
schemas - a set of Schema instances to mergeSchemapublic static org.apache.avro.Schema merge(org.apache.avro.Schema left,
org.apache.avro.Schema right)
Schema instances if they are compatible.
Two schemas are incompatible if:
Schema.Type does not match.Map value and array element types will use unions if necessary, and union schemas are merged recursively.
left - a Schemaright - a SchemaSchemaIllegalStateException - if the schemas are not compatiblepublic static org.apache.avro.Schema.Field copy(org.apache.avro.Schema.Field field)
Fields cannot be used in more than one record (not Immutable?).
field - an Avro schema fieldCopyright © 2023 The Apache Software Foundation. All rights reserved.