Package com.linkedin.venice.schema.avro
Class SchemaCompatibility
- java.lang.Object
-
- com.linkedin.venice.schema.avro.SchemaCompatibility
-
public class SchemaCompatibility extends java.lang.Object
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 Classes Modifier and Type Class Description static class
SchemaCompatibility.SchemaCompatibilityType
Identifies the type of a schema compatibility result.static class
SchemaCompatibility.SchemaPairCompatibility
Provides information about the compatibility of a single reader and writer schema pair.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
READER_WRITER_COMPATIBLE_MESSAGE
Message to annotate reader/writer schema pairs that are compatible.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SchemaCompatibility.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.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.static boolean
schemaNameEquals(org.apache.avro.Schema reader, org.apache.avro.Schema writer)
Tests the equality of two Avro named schemas.
-
-
-
Field Detail
-
READER_WRITER_COMPATIBLE_MESSAGE
public static final java.lang.String READER_WRITER_COMPATIBLE_MESSAGE
Message to annotate reader/writer schema pairs that are compatible.- See Also:
- Constant Field Values
-
-
Method Detail
-
checkReaderWriterCompatibility
public static SchemaCompatibility.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.
-
-