Top Description Inners Fields Constructors Methods
org.apache.avro

public Class SchemaCompatibility

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, .ArrayList, .Arrays, .Collections, .Deque, .HashMap, .List, .Map, .Objects, .Set, .TreeSet, org.apache.avro.Schema.Field, .Schema.Type, org.slf4j.Logger, .LoggerFactory

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 and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
SchemaCompatibility.ReaderWriter

Reader/writer schema pair that can be used as a key in a hash map.

private static class
SchemaCompatibility.ReaderWriterCompatibilityChecker

Determines the compatibility of a reader/writer schema pair.

public static class
SchemaCompatibility.SchemaCompatibilityResult

Immutable class representing details about a particular schema pair compatibility check.

public static enum
SchemaCompatibility.SchemaCompatibilityType

Identifies the type of a schema compatibility result.

public static enum
public static class
SchemaCompatibility.SchemaPairCompatibility

Provides information about the compatibility of a single reader and writer schema pair.

Field Summary

Modifier and TypeField and Description
private static final Logger
public static final String
READER_WRITER_COMPATIBLE_MESSAGE

Message to annotate reader/writer schema pairs that are compatible.

Constructor Summary

AccessConstructor and Description
private
SchemaCompatibility()

Utility class cannot be instantiated.

Method Summary

Modifier and TypeMethod and Description
private static List<String>
public static SchemaCompatibility.SchemaPairCompatibility

Returns:

a result object identifying any compatibility errors.
checkReaderWriterCompatibility
(final Schema
schema to check.
reader
,
final Schema
schema to check.
writer
)

Validates that the provided reader schema can be used to decode avro data written with the provided writer schema.

public static Schema.Field

Returns:

the writer field, if any does correspond, or None.
lookupWriterField
(final Schema
Schema of the record where to look for the writer field.
writerSchema
,
final Schema.Field
Reader field to identify the corresponding writer field of.
readerField
)

Identifies the writer field that corresponds to the specified reader field.

private static boolean
objectsEqual(Object obj1, Object obj2)

Borrowed from Guava's Objects.equal(a, b)

public static boolean

Returns:

whether the names of the named schemas match or not.
schemaNameEquals
(final Schema
Named reader schema.
reader
,
final Schema
Named writer schema.
writer
)

Tests the equality of two Avro named schemas.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait