resolve and also the separate document entitled
refactoring-resolution for more information. It might also be
helpful to study org.apache.avro.io.parsing.ResolvingGrammarGenerator
as an example of how to use this class.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | Resolver.Action
An abstract class for an action to be taken to resolve a writer's schema (found in public instance variable writer) against a reader's schema (in reader). |
| public static class | Resolver.Container
Used for array and map schemas: the public instance variable elementAction contains the resolving action needed for the element type of an array or value top of a map. |
| public static class | Resolver.DoNothing
In this case, there's nothing to be done for resolution: the two schemas are effectively the same. |
| public static class | Resolver.EnumAdjust
Contains information needed to resolve enumerations. |
| public static class | Resolver.ErrorAction
In this case there is an error. |
| public static class | Resolver.Promote
In this case, the writer's type needs to be promoted to the reader's. |
| public static class | Resolver.ReaderUnion
In this case, the reader is a union and the writer is not. |
| public static class | Resolver.RecordAdjust
Instructions for resolving two record schemas. |
| public static class | Resolver.Skip
This only appears inside |
| public static class | Resolver.WriterUnion
In this case, the writer was a union. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Resolver. | Returns: Nested actions for resolving the twoThe schema used by the writer writer, Schema The schema used by the reader reader, GenericData Used for getDefaultValue and getting conversions data)Returns a |
| public static Resolver. | |
| private static Resolver. | |
| private static boolean |
| Resolver | back to summary |
|---|---|
| public Resolver() | |
| resolve | back to summary |
|---|---|
| public static Resolver. Returns a
| |
| resolve | back to summary |
|---|---|
| public static Resolver. Uses GenericData.get() for the data param. | |
| resolve | back to summary |
|---|---|
| private static Resolver. | |
| unionEquiv | back to summary |
|---|---|
| private static boolean unionEquiv(Schema write, Schema read, Map<Schema. | |
Skip, which
is used to skip a field in a writer's record that doesn't exist in the
reader's (and thus there is no reader schema to resolve to).
| Modifier and Type | Class and Description |
|---|---|
| public static enum | Resolver.Action.Type
Helps us traverse faster. |
| Modifier and Type | Field and Description |
|---|---|
| public final Conversion | conversion
If the reader has a conversion that needs to be applied, it's stored here for fast access, otherwise this will be null. |
| public final LogicalType | logicalType
If the reader has a logical type, it's stored here for fast access, otherwise this will be null. |
| public final Schema | |
| public final Resolver. | |
| public final Schema |
| Access | Constructor and Description |
|---|---|
| protected |
| conversion | back to summary |
|---|---|
| public final Conversion<?> conversion If the reader has a conversion that needs to be applied, it's stored here for fast access, otherwise this will be null. | |
| logicalType | back to summary |
|---|---|
| public final LogicalType logicalType If the reader has a logical type, it's stored here for fast access, otherwise this will be null. | |
| reader | back to summary |
|---|---|
| public final Schema reader | |
| type | back to summary |
|---|---|
| public final Resolver. | |
| writer | back to summary |
|---|---|
| public final Schema writer | |
| Action | back to summary |
|---|---|
| protected Action(Schema w, Schema r, GenericData data, Resolver. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. | |
| public static final Resolver. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Resolver. | |
| public static Resolver. |
| CONTAINER | back to summary |
|---|---|
| public static final Resolver. | |
| DO_NOTHING | back to summary |
|---|---|
| public static final Resolver. | |
| ENUM | back to summary |
|---|---|
| public static final Resolver. | |
| ERROR | back to summary |
|---|---|
| public static final Resolver. | |
| PROMOTE | back to summary |
|---|---|
| public static final Resolver. | |
| READER_UNION | back to summary |
|---|---|
| public static final Resolver. | |
| RECORD | back to summary |
|---|---|
| public static final Resolver. | |
| SKIP | back to summary |
|---|---|
| public static final Resolver. | |
| WRITER_UNION | back to summary |
|---|---|
| public static final Resolver. | |
| Type | back to summary |
|---|---|
| private Type() | |
| valueOf | back to summary |
|---|---|
| public static Resolver. | |
| values | back to summary |
|---|---|
| public static Resolver. | |
| Modifier and Type | Field and Description |
|---|---|
| public final Resolver. |
| Access | Constructor and Description |
|---|---|
| public |
| elementAction | back to summary |
|---|---|
| public final Resolver. | |
| Container | back to summary |
|---|---|
| public Container(Schema w, Schema r, GenericData d, Resolver. | |
| Access | Constructor and Description |
|---|---|
| public |
| DoNothing | back to summary |
|---|---|
| public DoNothing(Schema w, Schema r, GenericData d) | |
| Modifier and Type | Field and Description |
|---|---|
| public final int[] | |
| public final boolean | |
| public final Object[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Resolver. | resolve(Schema w, Schema r, GenericData d)
If writer and reader don't have same name, a
|
| adjustments | back to summary |
|---|---|
| public final int[] adjustments | |
| noAdjustmentsNeeded | back to summary |
|---|---|
| public final boolean noAdjustmentsNeeded | |
| values | back to summary |
|---|---|
| public final Object[] values | |
| EnumAdjust | back to summary |
|---|---|
| private EnumAdjust(Schema w, Schema r, GenericData d, int[] adj, Object[] values) | |
| resolve | back to summary |
|---|---|
| public static Resolver. If writer and reader don't have same name, a
| |
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| public final Resolver. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| error | back to summary |
|---|---|
| public final Resolver. | |
| ErrorAction | back to summary |
|---|---|
| public ErrorAction(Schema w, Schema r, GenericData d, Resolver. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Resolver. | INCOMPATIBLE_SCHEMA_TYPES
Use when Schema types don't match and can't be converted. |
| public static final Resolver. | MISSING_REQUIRED_FIELD
Use when matching two records and the reader has a field with no default value and that field is missing in the writer.. |
| public static final Resolver. | NAMES_DONT_MATCH
Use when Schema types match but, in the case of record, enum, or fixed, the names don't match. |
| public static final Resolver. | NO_MATCHING_BRANCH
Use when matching a reader's union against a non-union and can't find a branch that matches. |
| public static final Resolver. | SIZES_DONT_MATCH
Use when two fixed types match and their names match by their sizes don't. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Resolver. | |
| public static Resolver. |
| INCOMPATIBLE_SCHEMA_TYPES | back to summary |
|---|---|
| public static final Resolver. Use when Schema types don't match and can't be converted. For example, resolving "int" and "enum". | |
| MISSING_REQUIRED_FIELD | back to summary |
|---|---|
| public static final Resolver. Use when matching two records and the reader has a field with no default value and that field is missing in the writer.. | |
| NAMES_DONT_MATCH | back to summary |
|---|---|
| public static final Resolver. Use when Schema types match but, in the case of record, enum, or fixed, the names don't match. | |
| NO_MATCHING_BRANCH | back to summary |
|---|---|
| public static final Resolver. Use when matching a reader's union against a non-union and can't find a branch that matches. | |
| SIZES_DONT_MATCH | back to summary |
|---|---|
| public static final Resolver. Use when two fixed types match and their names match by their sizes don't. | |
| ErrorType | back to summary |
|---|---|
| private ErrorType() | |
| valueOf | back to summary |
|---|---|
| public static Resolver. | |
| values | back to summary |
|---|---|
| public static Resolver. | |
Promote#resolve, which will only construct one
when the writer's and reader's schemas are different (ie, no "self
promotion"), and whent the promotion is one allowed by the Avro spec.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public static Resolver. | Returns: aPromote schema if the two schemas are compatible, or
ErrorType#INCOMPATIBLE_SCHEMA_TYPES if they are not.Writer's schema w, Schema Rearder's schema r, GenericData d)Return a promotion. |
| Promote | back to summary |
|---|---|
| private Promote(Schema w, Schema r, GenericData d) | |
| isValid | back to summary |
|---|---|
| public static boolean isValid(Schema w, Schema r) Returns true iff w and r are both primitive types and either they are the same type or w is promotable to r. Should | |
| resolve | back to summary |
|---|---|
| public static Resolver. Return a promotion.
| |
ReaderUnion object has two (public) fields:
firstMatch gives the index of the first matching branch in the
reader's schema, and actualResolution is the Action that
resolves the writer's schema with the schema found in the firstMatch
branch of the reader's schema.
| Modifier and Type | Field and Description |
|---|---|
| public final Resolver. | |
| public final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static int | |
| private static boolean | |
| public static Resolver. | resolve(Schema w, Schema r, GenericData d, Map<Schema.
Returns a |
| actualAction | back to summary |
|---|---|
| public final Resolver. | |
| firstMatch | back to summary |
|---|---|
| public final int firstMatch | |
| ReaderUnion | back to summary |
|---|---|
| public ReaderUnion(Schema w, Schema r, GenericData d, int firstMatch, Resolver. | |
| firstMatchingBranch | back to summary |
|---|---|
| private static int firstMatchingBranch(Schema w, Schema r, GenericData d, Map<Schema. | |
| hasMatchError | back to summary |
|---|---|
| private static boolean hasMatchError(Resolver. | |
| resolve | back to summary |
|---|---|
| public static Resolver. Returns a
| |
| Modifier and Type | Field and Description |
|---|---|
| public final Object[] | defaults
Contains the default values to be used for the last readerOrder.length-firstDefault fields in rearderOrder. |
| public final Resolver. | fieldActions
An action for each field of the writer. |
| public final int | firstDefault
Pointer into |
| public final GenericData. | instanceSupplier
Supplier that offers an optimized alternative to data.newRecord() |
| public final Schema. | readerOrder
Contains (all of) the reader's fields. |
| Access | Constructor and Description |
|---|---|
| private | RecordAdjust(Schema w, Schema r, GenericData d, Resolver.
|
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| pack-priv static Resolver. | resolve(Schema writeSchema, Schema readSchema, GenericData data, Map<Schema.
Returns a |
| defaults | back to summary |
|---|---|
| public final Object[] defaults Contains the default values to be used for the last readerOrder.length-firstDefault fields in rearderOrder. The ith element of defaults is the default value for the i+firstDefault member of readerOrder. | |
| fieldActions | back to summary |
|---|---|
| public final Resolver. An action for each field of the writer. If the corresponding field is to be
skipped during reading, then this will contain a | |
| firstDefault | back to summary |
|---|---|
| public final int firstDefault Pointer into | |
| instanceSupplier | back to summary |
|---|---|
| public final GenericData. Supplier that offers an optimized alternative to data.newRecord() | |
| readerOrder | back to summary |
|---|---|
| public final Schema. Contains (all of) the reader's fields. The first n of these are the
fields that will be read from the writer: these n are in the order
dictated by writer's schema. The remaining m fields will be read from
default values (actions for these default values are found in
| |
| RecordAdjust | back to summary |
|---|---|
| private RecordAdjust(Schema w, Schema r, GenericData d, Resolver. | |
| noReorder | back to summary |
|---|---|
| public boolean noReorder() Returns true iff | |
| resolve | back to summary |
|---|---|
| pack-priv static Resolver. Returns a
| |
RecordAdjust#fieldActions, i.e., the actions
for adjusting the fields of a record. This action indicates that the writer's
schema has a field that the reader's does not have, and thus the
field should be skipped. Since there is no corresponding reader's schema for
the writer's in this case, the Action#reader field is null
for this subclass.
| Access | Constructor and Description |
|---|---|
| public |
| Skip | back to summary |
|---|---|
| public Skip(Schema w, GenericData d) | |
| Modifier and Type | Field and Description |
|---|---|
| public final Resolver. | |
| public final boolean |
| Access | Constructor and Description |
|---|---|
| private |
| actions | back to summary |
|---|---|
| public final Resolver. | |
| unionEquiv | back to summary |
|---|---|
| public final boolean unionEquiv | |
| WriterUnion | back to summary |
|---|---|
| private WriterUnion(Schema w, Schema r, GenericData d, boolean ue, Resolver. | |