Package com.linkedin.venice.schema.avro
Class SchemaCompatibility19
java.lang.Object
com.linkedin.venice.schema.avro.SchemaCompatibility19
Evaluate the compatibility between a reader schema and a writer schema. A
reader and a writer schema are declared compatible if all datum instances of
the writer schema can be successfully decoded using the specified reader
schema.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classImmutable class representing details about a particular schema pair compatibility check.static enumIdentifies the type of a schema compatibility result.static enumstatic final classProvides information about the compatibility of a single reader and writer schema pair. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMessage to annotate reader/writer schema pairs that are compatible. -
Method Summary
Modifier and TypeMethodDescriptioncheckReaderWriterCompatibility(org.apache.avro.Schema reader, org.apache.avro.Schema writer) Validates that the provided reader schema can be used to decode avro data written with the provided writer schema.static org.apache.avro.Schema.FieldlookupWriterField(org.apache.avro.Schema writerSchema, org.apache.avro.Schema.Field readerField) Identifies the writer field that corresponds to the specified reader field.static booleanschemaNameEquals(org.apache.avro.Schema reader, org.apache.avro.Schema writer) Tests the equality of two Avro named schemas.
-
Field Details
-
READER_WRITER_COMPATIBLE_MESSAGE
Message to annotate reader/writer schema pairs that are compatible.- See Also:
-
-
Method Details
-
checkReaderWriterCompatibility
public static SchemaCompatibility19.SchemaPairCompatibility checkReaderWriterCompatibility(org.apache.avro.Schema reader, org.apache.avro.Schema writer) Validates that the provided reader schema can be used to decode avro data written with the provided writer schema.- Parameters:
reader- schema to check.writer- schema to check.- Returns:
- a result object identifying any compatibility errors.
-
schemaNameEquals
public static boolean schemaNameEquals(org.apache.avro.Schema reader, org.apache.avro.Schema writer) Tests the equality of two Avro named schemas.Matching includes reader name aliases.
- Parameters:
reader- Named reader schema.writer- Named writer schema.- Returns:
- whether the names of the named schemas match or not.
-
lookupWriterField
public static org.apache.avro.Schema.Field lookupWriterField(org.apache.avro.Schema writerSchema, org.apache.avro.Schema.Field readerField) Identifies the writer field that corresponds to the specified reader field.Matching includes reader name aliases.
- Parameters:
writerSchema- Schema of the record where to look for the writer field.readerField- Reader field to identify the corresponding writer field of.- Returns:
- the writer field, if any does correspond, or None.
-