Class Resolver.RecordAdjust

java.lang.Object
org.apache.avro.Resolver.Action
org.apache.avro.Resolver.RecordAdjust
Enclosing class:
Resolver

public static class Resolver.RecordAdjust extends Resolver.Action
Instructions for resolving two record schemas. Includes instructions on how to recursively resolve each field, an indication of when to skip (writer fields), plus information about which reader fields should be populated by defaults (because the writer doesn't have corresponding fields).
  • Field Details

    • fieldActions

      public final Resolver.Action[] fieldActions
      An action for each field of the writer. If the corresponding field is to be skipped during reading, then this will contain a Resolver.Skip. For fields to be read into the reading datum, will contain a regular action for resolving the writer/reader schemas of the matching fields.
    • readerOrder

      public final Schema.Field[] readerOrder
      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 defaults.
    • firstDefault

      public final int firstDefault
      Pointer into readerOrder of the first reader field whose value comes from a default value. Set to length of readerOrder if there are none.
    • defaults

      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.
    • instanceSupplier

      public final GenericData.InstanceSupplier instanceSupplier
      Supplier that offers an optimized alternative to data.newRecord()
  • Method Details

    • noReorder

      public boolean noReorder()
      Returns true iff i == readerOrder[i].pos() for all indices i. Which is to say: the order of the reader's fields is the same in both the reader's and writer's schema.