Package org.apache.avro
Class Resolver.ReaderUnion
java.lang.Object
org.apache.avro.Resolver.Action
org.apache.avro.Resolver.ReaderUnion
- Enclosing class:
Resolver
In this case, the reader is a union and the writer is not. For this case, we
need to pick the first branch of the reader that matches the writer and
pretend to the reader that the index of this branch was found in the writer's
data stream.
To support this case, the
Resolver.ReaderUnion
object has two (public) fields:
firstMatch gives the index of the first matching branch in the
reader's schema, and actualResolution is the Resolver.Action
that
resolves the writer's schema with the schema found in the firstMatch
branch of the reader's schema.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.avro.Resolver.Action
Resolver.Action.Type
-
Field Summary
Fields inherited from class org.apache.avro.Resolver.Action
conversion, logicalType, reader, type, writer
-
Constructor Summary
ConstructorDescriptionReaderUnion
(Schema w, Schema r, GenericData d, int firstMatch, Resolver.Action actual) -
Method Summary
Modifier and TypeMethodDescriptionstatic Resolver.Action
resolve
(Schema w, Schema r, GenericData d, Map<Schema.SeenPair, Resolver.Action> seen) Returns aResolver.ReaderUnion
action for resolving w and r, or anResolver.ErrorAction
if there is no branch in the reader that matches the writer.
-
Field Details
-
firstMatch
public final int firstMatch -
actualAction
-
-
Constructor Details
-
ReaderUnion
-
-
Method Details
-
resolve
public static Resolver.Action resolve(Schema w, Schema r, GenericData d, Map<Schema.SeenPair, Resolver.Action> seen) Returns aResolver.ReaderUnion
action for resolving w and r, or anResolver.ErrorAction
if there is no branch in the reader that matches the writer.- Throws:
RuntimeException
- if r is not a union schema or w is a union schema
-