All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hudi.avro.model.HoodieRollbackMetadata Maven / Gradle / Ivy

/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.apache.hudi.avro.model;

import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;

@org.apache.avro.specific.AvroGenerated
public class HoodieRollbackMetadata extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 4483563505512710939L;


  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HoodieRollbackMetadata\",\"namespace\":\"org.apache.hudi.avro.model\",\"fields\":[{\"name\":\"startRollbackTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"timeTakenInMillis\",\"type\":\"long\"},{\"name\":\"totalFilesDeleted\",\"type\":\"int\"},{\"name\":\"commitsRollback\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"partitionMetadata\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"HoodieRollbackPartitionMetadata\",\"fields\":[{\"name\":\"partitionPath\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"successDeleteFiles\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"failedDeleteFiles\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"rollbackLogFiles\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"logFilesFromFailedCommit\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\"}],\"default\":null}]},\"avro.java.string\":\"String\"}},{\"name\":\"version\",\"type\":[\"int\",\"null\"],\"default\":1},{\"name\":\"instantsRollback\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"HoodieInstantInfo\",\"fields\":[{\"name\":\"commitTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"action\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"default\":[]},\"default\":[]}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static final SpecificData MODEL$ = new SpecificData();

  private static final BinaryMessageEncoder ENCODER =
      new BinaryMessageEncoder<>(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder DECODER =
      new BinaryMessageDecoder<>(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageEncoder instance used by this class.
   * @return the message encoder used by this class
   */
  public static BinaryMessageEncoder getEncoder() {
    return ENCODER;
  }

  /**
   * Return the BinaryMessageDecoder instance used by this class.
   * @return the message decoder used by this class
   */
  public static BinaryMessageDecoder getDecoder() {
    return DECODER;
  }

  /**
   * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
   * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
   * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
   */
  public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder<>(MODEL$, SCHEMA$, resolver);
  }

  /**
   * Serializes this HoodieRollbackMetadata to a ByteBuffer.
   * @return a buffer holding the serialized data for this instance
   * @throws java.io.IOException if this instance could not be serialized
   */
  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
    return ENCODER.encode(this);
  }

  /**
   * Deserializes a HoodieRollbackMetadata from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a HoodieRollbackMetadata instance decoded from the given buffer
   * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
   */
  public static HoodieRollbackMetadata fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  private java.lang.String startRollbackTime;
  private long timeTakenInMillis;
  private int totalFilesDeleted;
  private java.util.List commitsRollback;
  private java.util.Map partitionMetadata;
  private java.lang.Integer version;
  private java.util.List instantsRollback;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder().
   */
  public HoodieRollbackMetadata() {}

  /**
   * All-args constructor.
   * @param startRollbackTime The new value for startRollbackTime
   * @param timeTakenInMillis The new value for timeTakenInMillis
   * @param totalFilesDeleted The new value for totalFilesDeleted
   * @param commitsRollback The new value for commitsRollback
   * @param partitionMetadata The new value for partitionMetadata
   * @param version The new value for version
   * @param instantsRollback The new value for instantsRollback
   */
  public HoodieRollbackMetadata(java.lang.String startRollbackTime, java.lang.Long timeTakenInMillis, java.lang.Integer totalFilesDeleted, java.util.List commitsRollback, java.util.Map partitionMetadata, java.lang.Integer version, java.util.List instantsRollback) {
    this.startRollbackTime = startRollbackTime;
    this.timeTakenInMillis = timeTakenInMillis;
    this.totalFilesDeleted = totalFilesDeleted;
    this.commitsRollback = commitsRollback;
    this.partitionMetadata = partitionMetadata;
    this.version = version;
    this.instantsRollback = instantsRollback;
  }

  @Override
  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }

  @Override
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }

  // Used by DatumWriter.  Applications should not call.
  @Override
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return startRollbackTime;
    case 1: return timeTakenInMillis;
    case 2: return totalFilesDeleted;
    case 3: return commitsRollback;
    case 4: return partitionMetadata;
    case 5: return version;
    case 6: return instantsRollback;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  // Used by DatumReader.  Applications should not call.
  @Override
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: startRollbackTime = value$ != null ? value$.toString() : null; break;
    case 1: timeTakenInMillis = (java.lang.Long)value$; break;
    case 2: totalFilesDeleted = (java.lang.Integer)value$; break;
    case 3: commitsRollback = (java.util.List)value$; break;
    case 4: partitionMetadata = (java.util.Map)value$; break;
    case 5: version = (java.lang.Integer)value$; break;
    case 6: instantsRollback = (java.util.List)value$; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  /**
   * Gets the value of the 'startRollbackTime' field.
   * @return The value of the 'startRollbackTime' field.
   */
  public java.lang.String getStartRollbackTime() {
    return startRollbackTime;
  }


  /**
   * Sets the value of the 'startRollbackTime' field.
   * @param value the value to set.
   */
  public void setStartRollbackTime(java.lang.String value) {
    this.startRollbackTime = value;
  }

  /**
   * Gets the value of the 'timeTakenInMillis' field.
   * @return The value of the 'timeTakenInMillis' field.
   */
  public long getTimeTakenInMillis() {
    return timeTakenInMillis;
  }


  /**
   * Sets the value of the 'timeTakenInMillis' field.
   * @param value the value to set.
   */
  public void setTimeTakenInMillis(long value) {
    this.timeTakenInMillis = value;
  }

  /**
   * Gets the value of the 'totalFilesDeleted' field.
   * @return The value of the 'totalFilesDeleted' field.
   */
  public int getTotalFilesDeleted() {
    return totalFilesDeleted;
  }


  /**
   * Sets the value of the 'totalFilesDeleted' field.
   * @param value the value to set.
   */
  public void setTotalFilesDeleted(int value) {
    this.totalFilesDeleted = value;
  }

  /**
   * Gets the value of the 'commitsRollback' field.
   * @return The value of the 'commitsRollback' field.
   */
  public java.util.List getCommitsRollback() {
    return commitsRollback;
  }


  /**
   * Sets the value of the 'commitsRollback' field.
   * @param value the value to set.
   */
  public void setCommitsRollback(java.util.List value) {
    this.commitsRollback = value;
  }

  /**
   * Gets the value of the 'partitionMetadata' field.
   * @return The value of the 'partitionMetadata' field.
   */
  public java.util.Map getPartitionMetadata() {
    return partitionMetadata;
  }


  /**
   * Sets the value of the 'partitionMetadata' field.
   * @param value the value to set.
   */
  public void setPartitionMetadata(java.util.Map value) {
    this.partitionMetadata = value;
  }

  /**
   * Gets the value of the 'version' field.
   * @return The value of the 'version' field.
   */
  public java.lang.Integer getVersion() {
    return version;
  }


  /**
   * Sets the value of the 'version' field.
   * @param value the value to set.
   */
  public void setVersion(java.lang.Integer value) {
    this.version = value;
  }

  /**
   * Gets the value of the 'instantsRollback' field.
   * @return The value of the 'instantsRollback' field.
   */
  public java.util.List getInstantsRollback() {
    return instantsRollback;
  }


  /**
   * Sets the value of the 'instantsRollback' field.
   * @param value the value to set.
   */
  public void setInstantsRollback(java.util.List value) {
    this.instantsRollback = value;
  }

  /**
   * Creates a new HoodieRollbackMetadata RecordBuilder.
   * @return A new HoodieRollbackMetadata RecordBuilder
   */
  public static org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder newBuilder() {
    return new org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder();
  }

  /**
   * Creates a new HoodieRollbackMetadata RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new HoodieRollbackMetadata RecordBuilder
   */
  public static org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder newBuilder(org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder other) {
    if (other == null) {
      return new org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder();
    } else {
      return new org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder(other);
    }
  }

  /**
   * Creates a new HoodieRollbackMetadata RecordBuilder by copying an existing HoodieRollbackMetadata instance.
   * @param other The existing instance to copy.
   * @return A new HoodieRollbackMetadata RecordBuilder
   */
  public static org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder newBuilder(org.apache.hudi.avro.model.HoodieRollbackMetadata other) {
    if (other == null) {
      return new org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder();
    } else {
      return new org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder(other);
    }
  }

  /**
   * RecordBuilder for HoodieRollbackMetadata instances.
   */
  @org.apache.avro.specific.AvroGenerated
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    private java.lang.String startRollbackTime;
    private long timeTakenInMillis;
    private int totalFilesDeleted;
    private java.util.List commitsRollback;
    private java.util.Map partitionMetadata;
    private java.lang.Integer version;
    private java.util.List instantsRollback;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$, MODEL$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.startRollbackTime)) {
        this.startRollbackTime = data().deepCopy(fields()[0].schema(), other.startRollbackTime);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (isValidValue(fields()[1], other.timeTakenInMillis)) {
        this.timeTakenInMillis = data().deepCopy(fields()[1].schema(), other.timeTakenInMillis);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.totalFilesDeleted)) {
        this.totalFilesDeleted = data().deepCopy(fields()[2].schema(), other.totalFilesDeleted);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.commitsRollback)) {
        this.commitsRollback = data().deepCopy(fields()[3].schema(), other.commitsRollback);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (isValidValue(fields()[4], other.partitionMetadata)) {
        this.partitionMetadata = data().deepCopy(fields()[4].schema(), other.partitionMetadata);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (isValidValue(fields()[5], other.version)) {
        this.version = data().deepCopy(fields()[5].schema(), other.version);
        fieldSetFlags()[5] = other.fieldSetFlags()[5];
      }
      if (isValidValue(fields()[6], other.instantsRollback)) {
        this.instantsRollback = data().deepCopy(fields()[6].schema(), other.instantsRollback);
        fieldSetFlags()[6] = other.fieldSetFlags()[6];
      }
    }

    /**
     * Creates a Builder by copying an existing HoodieRollbackMetadata instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.hudi.avro.model.HoodieRollbackMetadata other) {
      super(SCHEMA$, MODEL$);
      if (isValidValue(fields()[0], other.startRollbackTime)) {
        this.startRollbackTime = data().deepCopy(fields()[0].schema(), other.startRollbackTime);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.timeTakenInMillis)) {
        this.timeTakenInMillis = data().deepCopy(fields()[1].schema(), other.timeTakenInMillis);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.totalFilesDeleted)) {
        this.totalFilesDeleted = data().deepCopy(fields()[2].schema(), other.totalFilesDeleted);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.commitsRollback)) {
        this.commitsRollback = data().deepCopy(fields()[3].schema(), other.commitsRollback);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.partitionMetadata)) {
        this.partitionMetadata = data().deepCopy(fields()[4].schema(), other.partitionMetadata);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.version)) {
        this.version = data().deepCopy(fields()[5].schema(), other.version);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.instantsRollback)) {
        this.instantsRollback = data().deepCopy(fields()[6].schema(), other.instantsRollback);
        fieldSetFlags()[6] = true;
      }
    }

    /**
      * Gets the value of the 'startRollbackTime' field.
      * @return The value.
      */
    public java.lang.String getStartRollbackTime() {
      return startRollbackTime;
    }


    /**
      * Sets the value of the 'startRollbackTime' field.
      * @param value The value of 'startRollbackTime'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setStartRollbackTime(java.lang.String value) {
      validate(fields()[0], value);
      this.startRollbackTime = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'startRollbackTime' field has been set.
      * @return True if the 'startRollbackTime' field has been set, false otherwise.
      */
    public boolean hasStartRollbackTime() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'startRollbackTime' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearStartRollbackTime() {
      startRollbackTime = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'timeTakenInMillis' field.
      * @return The value.
      */
    public long getTimeTakenInMillis() {
      return timeTakenInMillis;
    }


    /**
      * Sets the value of the 'timeTakenInMillis' field.
      * @param value The value of 'timeTakenInMillis'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setTimeTakenInMillis(long value) {
      validate(fields()[1], value);
      this.timeTakenInMillis = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'timeTakenInMillis' field has been set.
      * @return True if the 'timeTakenInMillis' field has been set, false otherwise.
      */
    public boolean hasTimeTakenInMillis() {
      return fieldSetFlags()[1];
    }


    /**
      * Clears the value of the 'timeTakenInMillis' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearTimeTakenInMillis() {
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'totalFilesDeleted' field.
      * @return The value.
      */
    public int getTotalFilesDeleted() {
      return totalFilesDeleted;
    }


    /**
      * Sets the value of the 'totalFilesDeleted' field.
      * @param value The value of 'totalFilesDeleted'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setTotalFilesDeleted(int value) {
      validate(fields()[2], value);
      this.totalFilesDeleted = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'totalFilesDeleted' field has been set.
      * @return True if the 'totalFilesDeleted' field has been set, false otherwise.
      */
    public boolean hasTotalFilesDeleted() {
      return fieldSetFlags()[2];
    }


    /**
      * Clears the value of the 'totalFilesDeleted' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearTotalFilesDeleted() {
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'commitsRollback' field.
      * @return The value.
      */
    public java.util.List getCommitsRollback() {
      return commitsRollback;
    }


    /**
      * Sets the value of the 'commitsRollback' field.
      * @param value The value of 'commitsRollback'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setCommitsRollback(java.util.List value) {
      validate(fields()[3], value);
      this.commitsRollback = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'commitsRollback' field has been set.
      * @return True if the 'commitsRollback' field has been set, false otherwise.
      */
    public boolean hasCommitsRollback() {
      return fieldSetFlags()[3];
    }


    /**
      * Clears the value of the 'commitsRollback' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearCommitsRollback() {
      commitsRollback = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'partitionMetadata' field.
      * @return The value.
      */
    public java.util.Map getPartitionMetadata() {
      return partitionMetadata;
    }


    /**
      * Sets the value of the 'partitionMetadata' field.
      * @param value The value of 'partitionMetadata'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setPartitionMetadata(java.util.Map value) {
      validate(fields()[4], value);
      this.partitionMetadata = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /**
      * Checks whether the 'partitionMetadata' field has been set.
      * @return True if the 'partitionMetadata' field has been set, false otherwise.
      */
    public boolean hasPartitionMetadata() {
      return fieldSetFlags()[4];
    }


    /**
      * Clears the value of the 'partitionMetadata' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearPartitionMetadata() {
      partitionMetadata = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'version' field.
      * @return The value.
      */
    public java.lang.Integer getVersion() {
      return version;
    }


    /**
      * Sets the value of the 'version' field.
      * @param value The value of 'version'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setVersion(java.lang.Integer value) {
      validate(fields()[5], value);
      this.version = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /**
      * Checks whether the 'version' field has been set.
      * @return True if the 'version' field has been set, false otherwise.
      */
    public boolean hasVersion() {
      return fieldSetFlags()[5];
    }


    /**
      * Clears the value of the 'version' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearVersion() {
      version = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'instantsRollback' field.
      * @return The value.
      */
    public java.util.List getInstantsRollback() {
      return instantsRollback;
    }


    /**
      * Sets the value of the 'instantsRollback' field.
      * @param value The value of 'instantsRollback'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder setInstantsRollback(java.util.List value) {
      validate(fields()[6], value);
      this.instantsRollback = value;
      fieldSetFlags()[6] = true;
      return this;
    }

    /**
      * Checks whether the 'instantsRollback' field has been set.
      * @return True if the 'instantsRollback' field has been set, false otherwise.
      */
    public boolean hasInstantsRollback() {
      return fieldSetFlags()[6];
    }


    /**
      * Clears the value of the 'instantsRollback' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieRollbackMetadata.Builder clearInstantsRollback() {
      instantsRollback = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public HoodieRollbackMetadata build() {
      try {
        HoodieRollbackMetadata record = new HoodieRollbackMetadata();
        record.startRollbackTime = fieldSetFlags()[0] ? this.startRollbackTime : (java.lang.String) defaultValue(fields()[0]);
        record.timeTakenInMillis = fieldSetFlags()[1] ? this.timeTakenInMillis : (java.lang.Long) defaultValue(fields()[1]);
        record.totalFilesDeleted = fieldSetFlags()[2] ? this.totalFilesDeleted : (java.lang.Integer) defaultValue(fields()[2]);
        record.commitsRollback = fieldSetFlags()[3] ? this.commitsRollback : (java.util.List) defaultValue(fields()[3]);
        record.partitionMetadata = fieldSetFlags()[4] ? this.partitionMetadata : (java.util.Map) defaultValue(fields()[4]);
        record.version = fieldSetFlags()[5] ? this.version : (java.lang.Integer) defaultValue(fields()[5]);
        record.instantsRollback = fieldSetFlags()[6] ? this.instantsRollback : (java.util.List) defaultValue(fields()[6]);
        return record;
      } catch (org.apache.avro.AvroMissingFieldException e) {
        throw e;
      } catch (java.lang.Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumWriter
    WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, SpecificData.getEncoder(out));
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumReader
    READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, SpecificData.getDecoder(in));
  }

  @Override protected boolean hasCustomCoders() { return true; }

  @Override public void customEncode(org.apache.avro.io.Encoder out)
    throws java.io.IOException
  {
    out.writeString(this.startRollbackTime);

    out.writeLong(this.timeTakenInMillis);

    out.writeInt(this.totalFilesDeleted);

    long size0 = this.commitsRollback.size();
    out.writeArrayStart();
    out.setItemCount(size0);
    long actualSize0 = 0;
    for (java.lang.String e0: this.commitsRollback) {
      actualSize0++;
      out.startItem();
      out.writeString(e0);
    }
    out.writeArrayEnd();
    if (actualSize0 != size0)
      throw new java.util.ConcurrentModificationException("Array-size written was " + size0 + ", but element count was " + actualSize0 + ".");

    long size1 = this.partitionMetadata.size();
    out.writeMapStart();
    out.setItemCount(size1);
    long actualSize1 = 0;
    for (java.util.Map.Entry e1: this.partitionMetadata.entrySet()) {
      actualSize1++;
      out.startItem();
      out.writeString(e1.getKey());
      org.apache.hudi.avro.model.HoodieRollbackPartitionMetadata v1 = e1.getValue();
      v1.customEncode(out);
    }
    out.writeMapEnd();
    if (actualSize1 != size1)
      throw new java.util.ConcurrentModificationException("Map-size written was " + size1 + ", but element count was " + actualSize1 + ".");

    if (this.version == null) {
      out.writeIndex(1);
      out.writeNull();
    } else {
      out.writeIndex(0);
      out.writeInt(this.version);
    }

    long size2 = this.instantsRollback.size();
    out.writeArrayStart();
    out.setItemCount(size2);
    long actualSize2 = 0;
    for (org.apache.hudi.avro.model.HoodieInstantInfo e2: this.instantsRollback) {
      actualSize2++;
      out.startItem();
      e2.customEncode(out);
    }
    out.writeArrayEnd();
    if (actualSize2 != size2)
      throw new java.util.ConcurrentModificationException("Array-size written was " + size2 + ", but element count was " + actualSize2 + ".");

  }

  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
    throws java.io.IOException
  {
    org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
    if (fieldOrder == null) {
      this.startRollbackTime = in.readString();

      this.timeTakenInMillis = in.readLong();

      this.totalFilesDeleted = in.readInt();

      long size0 = in.readArrayStart();
      java.util.List a0 = this.commitsRollback;
      if (a0 == null) {
        a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("commitsRollback").schema());
        this.commitsRollback = a0;
      } else a0.clear();
      SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null);
      for ( ; 0 < size0; size0 = in.arrayNext()) {
        for ( ; size0 != 0; size0--) {
          java.lang.String e0 = (ga0 != null ? ga0.peek() : null);
          e0 = in.readString();
          a0.add(e0);
        }
      }

      long size1 = in.readMapStart();
      java.util.Map m1 = this.partitionMetadata; // Need fresh name due to limitation of macro system
      if (m1 == null) {
        m1 = new java.util.HashMap((int)size1);
        this.partitionMetadata = m1;
      } else m1.clear();
      for ( ; 0 < size1; size1 = in.mapNext()) {
        for ( ; size1 != 0; size1--) {
          java.lang.String k1 = null;
          k1 = in.readString();
          org.apache.hudi.avro.model.HoodieRollbackPartitionMetadata v1 = null;
          if (v1 == null) {
            v1 = new org.apache.hudi.avro.model.HoodieRollbackPartitionMetadata();
          }
          v1.customDecode(in);
          m1.put(k1, v1);
        }
      }

      if (in.readIndex() != 0) {
        in.readNull();
        this.version = null;
      } else {
        this.version = in.readInt();
      }

      long size2 = in.readArrayStart();
      java.util.List a2 = this.instantsRollback;
      if (a2 == null) {
        a2 = new SpecificData.Array((int)size2, SCHEMA$.getField("instantsRollback").schema());
        this.instantsRollback = a2;
      } else a2.clear();
      SpecificData.Array ga2 = (a2 instanceof SpecificData.Array ? (SpecificData.Array)a2 : null);
      for ( ; 0 < size2; size2 = in.arrayNext()) {
        for ( ; size2 != 0; size2--) {
          org.apache.hudi.avro.model.HoodieInstantInfo e2 = (ga2 != null ? ga2.peek() : null);
          if (e2 == null) {
            e2 = new org.apache.hudi.avro.model.HoodieInstantInfo();
          }
          e2.customDecode(in);
          a2.add(e2);
        }
      }

    } else {
      for (int i = 0; i < 7; i++) {
        switch (fieldOrder[i].pos()) {
        case 0:
          this.startRollbackTime = in.readString();
          break;

        case 1:
          this.timeTakenInMillis = in.readLong();
          break;

        case 2:
          this.totalFilesDeleted = in.readInt();
          break;

        case 3:
          long size0 = in.readArrayStart();
          java.util.List a0 = this.commitsRollback;
          if (a0 == null) {
            a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("commitsRollback").schema());
            this.commitsRollback = a0;
          } else a0.clear();
          SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null);
          for ( ; 0 < size0; size0 = in.arrayNext()) {
            for ( ; size0 != 0; size0--) {
              java.lang.String e0 = (ga0 != null ? ga0.peek() : null);
              e0 = in.readString();
              a0.add(e0);
            }
          }
          break;

        case 4:
          long size1 = in.readMapStart();
          java.util.Map m1 = this.partitionMetadata; // Need fresh name due to limitation of macro system
          if (m1 == null) {
            m1 = new java.util.HashMap((int)size1);
            this.partitionMetadata = m1;
          } else m1.clear();
          for ( ; 0 < size1; size1 = in.mapNext()) {
            for ( ; size1 != 0; size1--) {
              java.lang.String k1 = null;
              k1 = in.readString();
              org.apache.hudi.avro.model.HoodieRollbackPartitionMetadata v1 = null;
              if (v1 == null) {
                v1 = new org.apache.hudi.avro.model.HoodieRollbackPartitionMetadata();
              }
              v1.customDecode(in);
              m1.put(k1, v1);
            }
          }
          break;

        case 5:
          if (in.readIndex() != 0) {
            in.readNull();
            this.version = null;
          } else {
            this.version = in.readInt();
          }
          break;

        case 6:
          long size2 = in.readArrayStart();
          java.util.List a2 = this.instantsRollback;
          if (a2 == null) {
            a2 = new SpecificData.Array((int)size2, SCHEMA$.getField("instantsRollback").schema());
            this.instantsRollback = a2;
          } else a2.clear();
          SpecificData.Array ga2 = (a2 instanceof SpecificData.Array ? (SpecificData.Array)a2 : null);
          for ( ; 0 < size2; size2 = in.arrayNext()) {
            for ( ; size2 != 0; size2--) {
              org.apache.hudi.avro.model.HoodieInstantInfo e2 = (ga2 != null ? ga2.peek() : null);
              if (e2 == null) {
                e2 = new org.apache.hudi.avro.model.HoodieInstantInfo();
              }
              e2.customDecode(in);
              a2.add(e2);
            }
          }
          break;

        default:
          throw new java.io.IOException("Corrupt ResolvingDecoder.");
        }
      }
    }
  }
}














© 2015 - 2025 Weber Informatics LLC | Privacy Policy