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

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

The newest version!
/**
 * 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 HoodieCleanerPlan extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = -7151707665545638584L;


  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HoodieCleanerPlan\",\"namespace\":\"org.apache.hudi.avro.model\",\"fields\":[{\"name\":\"earliestInstantToRetain\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"HoodieActionInstant\",\"fields\":[{\"name\":\"timestamp\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"action\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"state\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}],\"default\":null},{\"name\":\"lastCompletedCommitTimestamp\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"policy\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"filesToBeDeletedPerPartition\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"version\",\"type\":[\"int\",\"null\"],\"default\":1},{\"name\":\"filePathsToBeDeletedPerPartition\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"HoodieCleanFileInfo\",\"fields\":[{\"name\":\"filePath\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"isBootstrapBaseFile\",\"type\":[\"null\",\"boolean\"],\"default\":null}]}},\"avro.java.string\":\"String\"}],\"doc\":\"This field replaces the field filesToBeDeletedPerPartition\",\"default\":null},{\"name\":\"partitionsToBeDeleted\",\"type\":[\"null\",{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}],\"doc\":\"partitions to be deleted\",\"default\":null},{\"name\":\"extraMetadata\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\",\"default\":null}],\"default\":null}]}");
  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 HoodieCleanerPlan 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 HoodieCleanerPlan from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a HoodieCleanerPlan 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 HoodieCleanerPlan fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  private org.apache.hudi.avro.model.HoodieActionInstant earliestInstantToRetain;
  private java.lang.String lastCompletedCommitTimestamp;
  private java.lang.String policy;
  private java.util.Map> filesToBeDeletedPerPartition;
  private java.lang.Integer version;
  /** This field replaces the field filesToBeDeletedPerPartition */
  private java.util.Map> filePathsToBeDeletedPerPartition;
  /** partitions to be deleted */
  private java.util.List partitionsToBeDeleted;
  private java.util.Map extraMetadata;

  /**
   * 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 HoodieCleanerPlan() {}

  /**
   * All-args constructor.
   * @param earliestInstantToRetain The new value for earliestInstantToRetain
   * @param lastCompletedCommitTimestamp The new value for lastCompletedCommitTimestamp
   * @param policy The new value for policy
   * @param filesToBeDeletedPerPartition The new value for filesToBeDeletedPerPartition
   * @param version The new value for version
   * @param filePathsToBeDeletedPerPartition This field replaces the field filesToBeDeletedPerPartition
   * @param partitionsToBeDeleted partitions to be deleted
   * @param extraMetadata The new value for extraMetadata
   */
  public HoodieCleanerPlan(org.apache.hudi.avro.model.HoodieActionInstant earliestInstantToRetain, java.lang.String lastCompletedCommitTimestamp, java.lang.String policy, java.util.Map> filesToBeDeletedPerPartition, java.lang.Integer version, java.util.Map> filePathsToBeDeletedPerPartition, java.util.List partitionsToBeDeleted, java.util.Map extraMetadata) {
    this.earliestInstantToRetain = earliestInstantToRetain;
    this.lastCompletedCommitTimestamp = lastCompletedCommitTimestamp;
    this.policy = policy;
    this.filesToBeDeletedPerPartition = filesToBeDeletedPerPartition;
    this.version = version;
    this.filePathsToBeDeletedPerPartition = filePathsToBeDeletedPerPartition;
    this.partitionsToBeDeleted = partitionsToBeDeleted;
    this.extraMetadata = extraMetadata;
  }

  @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 earliestInstantToRetain;
    case 1: return lastCompletedCommitTimestamp;
    case 2: return policy;
    case 3: return filesToBeDeletedPerPartition;
    case 4: return version;
    case 5: return filePathsToBeDeletedPerPartition;
    case 6: return partitionsToBeDeleted;
    case 7: return extraMetadata;
    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: earliestInstantToRetain = (org.apache.hudi.avro.model.HoodieActionInstant)value$; break;
    case 1: lastCompletedCommitTimestamp = value$ != null ? value$.toString() : null; break;
    case 2: policy = value$ != null ? value$.toString() : null; break;
    case 3: filesToBeDeletedPerPartition = (java.util.Map>)value$; break;
    case 4: version = (java.lang.Integer)value$; break;
    case 5: filePathsToBeDeletedPerPartition = (java.util.Map>)value$; break;
    case 6: partitionsToBeDeleted = (java.util.List)value$; break;
    case 7: extraMetadata = (java.util.Map)value$; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  /**
   * Gets the value of the 'earliestInstantToRetain' field.
   * @return The value of the 'earliestInstantToRetain' field.
   */
  public org.apache.hudi.avro.model.HoodieActionInstant getEarliestInstantToRetain() {
    return earliestInstantToRetain;
  }


  /**
   * Sets the value of the 'earliestInstantToRetain' field.
   * @param value the value to set.
   */
  public void setEarliestInstantToRetain(org.apache.hudi.avro.model.HoodieActionInstant value) {
    this.earliestInstantToRetain = value;
  }

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


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

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


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

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


  /**
   * Sets the value of the 'filesToBeDeletedPerPartition' field.
   * @param value the value to set.
   */
  public void setFilesToBeDeletedPerPartition(java.util.Map> value) {
    this.filesToBeDeletedPerPartition = 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 'filePathsToBeDeletedPerPartition' field.
   * @return This field replaces the field filesToBeDeletedPerPartition
   */
  public java.util.Map> getFilePathsToBeDeletedPerPartition() {
    return filePathsToBeDeletedPerPartition;
  }


  /**
   * Sets the value of the 'filePathsToBeDeletedPerPartition' field.
   * This field replaces the field filesToBeDeletedPerPartition
   * @param value the value to set.
   */
  public void setFilePathsToBeDeletedPerPartition(java.util.Map> value) {
    this.filePathsToBeDeletedPerPartition = value;
  }

  /**
   * Gets the value of the 'partitionsToBeDeleted' field.
   * @return partitions to be deleted
   */
  public java.util.List getPartitionsToBeDeleted() {
    return partitionsToBeDeleted;
  }


  /**
   * Sets the value of the 'partitionsToBeDeleted' field.
   * partitions to be deleted
   * @param value the value to set.
   */
  public void setPartitionsToBeDeleted(java.util.List value) {
    this.partitionsToBeDeleted = value;
  }

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


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

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

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

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

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

    private org.apache.hudi.avro.model.HoodieActionInstant earliestInstantToRetain;
    private org.apache.hudi.avro.model.HoodieActionInstant.Builder earliestInstantToRetainBuilder;
    private java.lang.String lastCompletedCommitTimestamp;
    private java.lang.String policy;
    private java.util.Map> filesToBeDeletedPerPartition;
    private java.lang.Integer version;
    /** This field replaces the field filesToBeDeletedPerPartition */
    private java.util.Map> filePathsToBeDeletedPerPartition;
    /** partitions to be deleted */
    private java.util.List partitionsToBeDeleted;
    private java.util.Map extraMetadata;

    /** 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.HoodieCleanerPlan.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.earliestInstantToRetain)) {
        this.earliestInstantToRetain = data().deepCopy(fields()[0].schema(), other.earliestInstantToRetain);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (other.hasEarliestInstantToRetainBuilder()) {
        this.earliestInstantToRetainBuilder = org.apache.hudi.avro.model.HoodieActionInstant.newBuilder(other.getEarliestInstantToRetainBuilder());
      }
      if (isValidValue(fields()[1], other.lastCompletedCommitTimestamp)) {
        this.lastCompletedCommitTimestamp = data().deepCopy(fields()[1].schema(), other.lastCompletedCommitTimestamp);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.policy)) {
        this.policy = data().deepCopy(fields()[2].schema(), other.policy);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.filesToBeDeletedPerPartition)) {
        this.filesToBeDeletedPerPartition = data().deepCopy(fields()[3].schema(), other.filesToBeDeletedPerPartition);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (isValidValue(fields()[4], other.version)) {
        this.version = data().deepCopy(fields()[4].schema(), other.version);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (isValidValue(fields()[5], other.filePathsToBeDeletedPerPartition)) {
        this.filePathsToBeDeletedPerPartition = data().deepCopy(fields()[5].schema(), other.filePathsToBeDeletedPerPartition);
        fieldSetFlags()[5] = other.fieldSetFlags()[5];
      }
      if (isValidValue(fields()[6], other.partitionsToBeDeleted)) {
        this.partitionsToBeDeleted = data().deepCopy(fields()[6].schema(), other.partitionsToBeDeleted);
        fieldSetFlags()[6] = other.fieldSetFlags()[6];
      }
      if (isValidValue(fields()[7], other.extraMetadata)) {
        this.extraMetadata = data().deepCopy(fields()[7].schema(), other.extraMetadata);
        fieldSetFlags()[7] = other.fieldSetFlags()[7];
      }
    }

    /**
     * Creates a Builder by copying an existing HoodieCleanerPlan instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.hudi.avro.model.HoodieCleanerPlan other) {
      super(SCHEMA$, MODEL$);
      if (isValidValue(fields()[0], other.earliestInstantToRetain)) {
        this.earliestInstantToRetain = data().deepCopy(fields()[0].schema(), other.earliestInstantToRetain);
        fieldSetFlags()[0] = true;
      }
      this.earliestInstantToRetainBuilder = null;
      if (isValidValue(fields()[1], other.lastCompletedCommitTimestamp)) {
        this.lastCompletedCommitTimestamp = data().deepCopy(fields()[1].schema(), other.lastCompletedCommitTimestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.policy)) {
        this.policy = data().deepCopy(fields()[2].schema(), other.policy);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.filesToBeDeletedPerPartition)) {
        this.filesToBeDeletedPerPartition = data().deepCopy(fields()[3].schema(), other.filesToBeDeletedPerPartition);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.version)) {
        this.version = data().deepCopy(fields()[4].schema(), other.version);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.filePathsToBeDeletedPerPartition)) {
        this.filePathsToBeDeletedPerPartition = data().deepCopy(fields()[5].schema(), other.filePathsToBeDeletedPerPartition);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.partitionsToBeDeleted)) {
        this.partitionsToBeDeleted = data().deepCopy(fields()[6].schema(), other.partitionsToBeDeleted);
        fieldSetFlags()[6] = true;
      }
      if (isValidValue(fields()[7], other.extraMetadata)) {
        this.extraMetadata = data().deepCopy(fields()[7].schema(), other.extraMetadata);
        fieldSetFlags()[7] = true;
      }
    }

    /**
      * Gets the value of the 'earliestInstantToRetain' field.
      * @return The value.
      */
    public org.apache.hudi.avro.model.HoodieActionInstant getEarliestInstantToRetain() {
      return earliestInstantToRetain;
    }


    /**
      * Sets the value of the 'earliestInstantToRetain' field.
      * @param value The value of 'earliestInstantToRetain'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCleanerPlan.Builder setEarliestInstantToRetain(org.apache.hudi.avro.model.HoodieActionInstant value) {
      validate(fields()[0], value);
      this.earliestInstantToRetainBuilder = null;
      this.earliestInstantToRetain = value;
      fieldSetFlags()[0] = true;
      return this;
    }

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

    /**
     * Gets the Builder instance for the 'earliestInstantToRetain' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public org.apache.hudi.avro.model.HoodieActionInstant.Builder getEarliestInstantToRetainBuilder() {
      if (earliestInstantToRetainBuilder == null) {
        if (hasEarliestInstantToRetain()) {
          setEarliestInstantToRetainBuilder(org.apache.hudi.avro.model.HoodieActionInstant.newBuilder(earliestInstantToRetain));
        } else {
          setEarliestInstantToRetainBuilder(org.apache.hudi.avro.model.HoodieActionInstant.newBuilder());
        }
      }
      return earliestInstantToRetainBuilder;
    }

    /**
     * Sets the Builder instance for the 'earliestInstantToRetain' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */

    public org.apache.hudi.avro.model.HoodieCleanerPlan.Builder setEarliestInstantToRetainBuilder(org.apache.hudi.avro.model.HoodieActionInstant.Builder value) {
      clearEarliestInstantToRetain();
      earliestInstantToRetainBuilder = value;
      return this;
    }

    /**
     * Checks whether the 'earliestInstantToRetain' field has an active Builder instance
     * @return True if the 'earliestInstantToRetain' field has an active Builder instance
     */
    public boolean hasEarliestInstantToRetainBuilder() {
      return earliestInstantToRetainBuilder != null;
    }

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

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


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

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


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

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


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

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


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

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


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

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


    /**
      * Clears the value of the 'filesToBeDeletedPerPartition' field.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCleanerPlan.Builder clearFilesToBeDeletedPerPartition() {
      filesToBeDeletedPerPartition = null;
      fieldSetFlags()[3] = 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.HoodieCleanerPlan.Builder setVersion(java.lang.Integer value) {
      validate(fields()[4], value);
      this.version = value;
      fieldSetFlags()[4] = 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()[4];
    }


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

    /**
      * Gets the value of the 'filePathsToBeDeletedPerPartition' field.
      * This field replaces the field filesToBeDeletedPerPartition
      * @return The value.
      */
    public java.util.Map> getFilePathsToBeDeletedPerPartition() {
      return filePathsToBeDeletedPerPartition;
    }


    /**
      * Sets the value of the 'filePathsToBeDeletedPerPartition' field.
      * This field replaces the field filesToBeDeletedPerPartition
      * @param value The value of 'filePathsToBeDeletedPerPartition'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCleanerPlan.Builder setFilePathsToBeDeletedPerPartition(java.util.Map> value) {
      validate(fields()[5], value);
      this.filePathsToBeDeletedPerPartition = value;
      fieldSetFlags()[5] = true;
      return this;
    }

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


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

    /**
      * Gets the value of the 'partitionsToBeDeleted' field.
      * partitions to be deleted
      * @return The value.
      */
    public java.util.List getPartitionsToBeDeleted() {
      return partitionsToBeDeleted;
    }


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

    /**
      * Checks whether the 'partitionsToBeDeleted' field has been set.
      * partitions to be deleted
      * @return True if the 'partitionsToBeDeleted' field has been set, false otherwise.
      */
    public boolean hasPartitionsToBeDeleted() {
      return fieldSetFlags()[6];
    }


    /**
      * Clears the value of the 'partitionsToBeDeleted' field.
      * partitions to be deleted
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCleanerPlan.Builder clearPartitionsToBeDeleted() {
      partitionsToBeDeleted = null;
      fieldSetFlags()[6] = false;
      return this;
    }

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


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

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


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

    @Override
    @SuppressWarnings("unchecked")
    public HoodieCleanerPlan build() {
      try {
        HoodieCleanerPlan record = new HoodieCleanerPlan();
        if (earliestInstantToRetainBuilder != null) {
          try {
            record.earliestInstantToRetain = this.earliestInstantToRetainBuilder.build();
          } catch (org.apache.avro.AvroMissingFieldException e) {
            e.addParentField(record.getSchema().getField("earliestInstantToRetain"));
            throw e;
          }
        } else {
          record.earliestInstantToRetain = fieldSetFlags()[0] ? this.earliestInstantToRetain : (org.apache.hudi.avro.model.HoodieActionInstant) defaultValue(fields()[0]);
        }
        record.lastCompletedCommitTimestamp = fieldSetFlags()[1] ? this.lastCompletedCommitTimestamp : (java.lang.String) defaultValue(fields()[1]);
        record.policy = fieldSetFlags()[2] ? this.policy : (java.lang.String) defaultValue(fields()[2]);
        record.filesToBeDeletedPerPartition = fieldSetFlags()[3] ? this.filesToBeDeletedPerPartition : (java.util.Map>) defaultValue(fields()[3]);
        record.version = fieldSetFlags()[4] ? this.version : (java.lang.Integer) defaultValue(fields()[4]);
        record.filePathsToBeDeletedPerPartition = fieldSetFlags()[5] ? this.filePathsToBeDeletedPerPartition : (java.util.Map>) defaultValue(fields()[5]);
        record.partitionsToBeDeleted = fieldSetFlags()[6] ? this.partitionsToBeDeleted : (java.util.List) defaultValue(fields()[6]);
        record.extraMetadata = fieldSetFlags()[7] ? this.extraMetadata : (java.util.Map) defaultValue(fields()[7]);
        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
  {
    if (this.earliestInstantToRetain == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      this.earliestInstantToRetain.customEncode(out);
    }

    out.writeString(this.lastCompletedCommitTimestamp);

    out.writeString(this.policy);

    if (this.filesToBeDeletedPerPartition == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      long size0 = this.filesToBeDeletedPerPartition.size();
      out.writeMapStart();
      out.setItemCount(size0);
      long actualSize0 = 0;
      for (java.util.Map.Entry> e0: this.filesToBeDeletedPerPartition.entrySet()) {
        actualSize0++;
        out.startItem();
        out.writeString(e0.getKey());
        java.util.List v0 = e0.getValue();
        long size1 = v0.size();
        out.writeArrayStart();
        out.setItemCount(size1);
        long actualSize1 = 0;
        for (java.lang.String e1: v0) {
          actualSize1++;
          out.startItem();
          out.writeString(e1);
        }
        out.writeArrayEnd();
        if (actualSize1 != size1)
          throw new java.util.ConcurrentModificationException("Array-size written was " + size1 + ", but element count was " + actualSize1 + ".");
      }
      out.writeMapEnd();
      if (actualSize0 != size0)
      throw new java.util.ConcurrentModificationException("Map-size written was " + size0 + ", but element count was " + actualSize0 + ".");
    }

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

    if (this.filePathsToBeDeletedPerPartition == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      long size2 = this.filePathsToBeDeletedPerPartition.size();
      out.writeMapStart();
      out.setItemCount(size2);
      long actualSize2 = 0;
      for (java.util.Map.Entry> e2: this.filePathsToBeDeletedPerPartition.entrySet()) {
        actualSize2++;
        out.startItem();
        out.writeString(e2.getKey());
        java.util.List v2 = e2.getValue();
        long size3 = v2.size();
        out.writeArrayStart();
        out.setItemCount(size3);
        long actualSize3 = 0;
        for (org.apache.hudi.avro.model.HoodieCleanFileInfo e3: v2) {
          actualSize3++;
          out.startItem();
          e3.customEncode(out);
        }
        out.writeArrayEnd();
        if (actualSize3 != size3)
          throw new java.util.ConcurrentModificationException("Array-size written was " + size3 + ", but element count was " + actualSize3 + ".");
      }
      out.writeMapEnd();
      if (actualSize2 != size2)
      throw new java.util.ConcurrentModificationException("Map-size written was " + size2 + ", but element count was " + actualSize2 + ".");
    }

    if (this.partitionsToBeDeleted == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      long size4 = this.partitionsToBeDeleted.size();
      out.writeArrayStart();
      out.setItemCount(size4);
      long actualSize4 = 0;
      for (java.lang.String e4: this.partitionsToBeDeleted) {
        actualSize4++;
        out.startItem();
        out.writeString(e4);
      }
      out.writeArrayEnd();
      if (actualSize4 != size4)
        throw new java.util.ConcurrentModificationException("Array-size written was " + size4 + ", but element count was " + actualSize4 + ".");
    }

    if (this.extraMetadata == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      long size5 = this.extraMetadata.size();
      out.writeMapStart();
      out.setItemCount(size5);
      long actualSize5 = 0;
      for (java.util.Map.Entry e5: this.extraMetadata.entrySet()) {
        actualSize5++;
        out.startItem();
        out.writeString(e5.getKey());
        java.lang.String v5 = e5.getValue();
        out.writeString(v5);
      }
      out.writeMapEnd();
      if (actualSize5 != size5)
      throw new java.util.ConcurrentModificationException("Map-size written was " + size5 + ", but element count was " + actualSize5 + ".");
    }

  }

  @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) {
      if (in.readIndex() != 1) {
        in.readNull();
        this.earliestInstantToRetain = null;
      } else {
        if (this.earliestInstantToRetain == null) {
          this.earliestInstantToRetain = new org.apache.hudi.avro.model.HoodieActionInstant();
        }
        this.earliestInstantToRetain.customDecode(in);
      }

      this.lastCompletedCommitTimestamp = in.readString();

      this.policy = in.readString();

      if (in.readIndex() != 1) {
        in.readNull();
        this.filesToBeDeletedPerPartition = null;
      } else {
        long size0 = in.readMapStart();
        java.util.Map> m0 = this.filesToBeDeletedPerPartition; // Need fresh name due to limitation of macro system
        if (m0 == null) {
          m0 = new java.util.HashMap>((int)size0);
          this.filesToBeDeletedPerPartition = m0;
        } else m0.clear();
        for ( ; 0 < size0; size0 = in.mapNext()) {
          for ( ; size0 != 0; size0--) {
            java.lang.String k0 = null;
            k0 = in.readString();
            java.util.List v0 = null;
            long size1 = in.readArrayStart();
            java.util.List a1 = v0;
            if (a1 == null) {
              a1 = new SpecificData.Array((int)size1, SCHEMA$.getField("filesToBeDeletedPerPartition").schema().getTypes().get(1).getValueType());
              v0 = a1;
            } else a1.clear();
            SpecificData.Array ga1 = (a1 instanceof SpecificData.Array ? (SpecificData.Array)a1 : null);
            for ( ; 0 < size1; size1 = in.arrayNext()) {
              for ( ; size1 != 0; size1--) {
                java.lang.String e1 = (ga1 != null ? ga1.peek() : null);
                e1 = in.readString();
                a1.add(e1);
              }
            }
            m0.put(k0, v0);
          }
        }
      }

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

      if (in.readIndex() != 1) {
        in.readNull();
        this.filePathsToBeDeletedPerPartition = null;
      } else {
        long size2 = in.readMapStart();
        java.util.Map> m2 = this.filePathsToBeDeletedPerPartition; // Need fresh name due to limitation of macro system
        if (m2 == null) {
          m2 = new java.util.HashMap>((int)size2);
          this.filePathsToBeDeletedPerPartition = m2;
        } else m2.clear();
        for ( ; 0 < size2; size2 = in.mapNext()) {
          for ( ; size2 != 0; size2--) {
            java.lang.String k2 = null;
            k2 = in.readString();
            java.util.List v2 = null;
            long size3 = in.readArrayStart();
            java.util.List a3 = v2;
            if (a3 == null) {
              a3 = new SpecificData.Array((int)size3, SCHEMA$.getField("filePathsToBeDeletedPerPartition").schema().getTypes().get(1).getValueType());
              v2 = a3;
            } else a3.clear();
            SpecificData.Array ga3 = (a3 instanceof SpecificData.Array ? (SpecificData.Array)a3 : null);
            for ( ; 0 < size3; size3 = in.arrayNext()) {
              for ( ; size3 != 0; size3--) {
                org.apache.hudi.avro.model.HoodieCleanFileInfo e3 = (ga3 != null ? ga3.peek() : null);
                if (e3 == null) {
                  e3 = new org.apache.hudi.avro.model.HoodieCleanFileInfo();
                }
                e3.customDecode(in);
                a3.add(e3);
              }
            }
            m2.put(k2, v2);
          }
        }
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.partitionsToBeDeleted = null;
      } else {
        long size4 = in.readArrayStart();
        java.util.List a4 = this.partitionsToBeDeleted;
        if (a4 == null) {
          a4 = new SpecificData.Array((int)size4, SCHEMA$.getField("partitionsToBeDeleted").schema().getTypes().get(1));
          this.partitionsToBeDeleted = a4;
        } else a4.clear();
        SpecificData.Array ga4 = (a4 instanceof SpecificData.Array ? (SpecificData.Array)a4 : null);
        for ( ; 0 < size4; size4 = in.arrayNext()) {
          for ( ; size4 != 0; size4--) {
            java.lang.String e4 = (ga4 != null ? ga4.peek() : null);
            e4 = in.readString();
            a4.add(e4);
          }
        }
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.extraMetadata = null;
      } else {
        long size5 = in.readMapStart();
        java.util.Map m5 = this.extraMetadata; // Need fresh name due to limitation of macro system
        if (m5 == null) {
          m5 = new java.util.HashMap((int)size5);
          this.extraMetadata = m5;
        } else m5.clear();
        for ( ; 0 < size5; size5 = in.mapNext()) {
          for ( ; size5 != 0; size5--) {
            java.lang.String k5 = null;
            k5 = in.readString();
            java.lang.String v5 = null;
            v5 = in.readString();
            m5.put(k5, v5);
          }
        }
      }

    } else {
      for (int i = 0; i < 8; i++) {
        switch (fieldOrder[i].pos()) {
        case 0:
          if (in.readIndex() != 1) {
            in.readNull();
            this.earliestInstantToRetain = null;
          } else {
            if (this.earliestInstantToRetain == null) {
              this.earliestInstantToRetain = new org.apache.hudi.avro.model.HoodieActionInstant();
            }
            this.earliestInstantToRetain.customDecode(in);
          }
          break;

        case 1:
          this.lastCompletedCommitTimestamp = in.readString();
          break;

        case 2:
          this.policy = in.readString();
          break;

        case 3:
          if (in.readIndex() != 1) {
            in.readNull();
            this.filesToBeDeletedPerPartition = null;
          } else {
            long size0 = in.readMapStart();
            java.util.Map> m0 = this.filesToBeDeletedPerPartition; // Need fresh name due to limitation of macro system
            if (m0 == null) {
              m0 = new java.util.HashMap>((int)size0);
              this.filesToBeDeletedPerPartition = m0;
            } else m0.clear();
            for ( ; 0 < size0; size0 = in.mapNext()) {
              for ( ; size0 != 0; size0--) {
                java.lang.String k0 = null;
                k0 = in.readString();
                java.util.List v0 = null;
                long size1 = in.readArrayStart();
                java.util.List a1 = v0;
                if (a1 == null) {
                  a1 = new SpecificData.Array((int)size1, SCHEMA$.getField("filesToBeDeletedPerPartition").schema().getTypes().get(1).getValueType());
                  v0 = a1;
                } else a1.clear();
                SpecificData.Array ga1 = (a1 instanceof SpecificData.Array ? (SpecificData.Array)a1 : null);
                for ( ; 0 < size1; size1 = in.arrayNext()) {
                  for ( ; size1 != 0; size1--) {
                    java.lang.String e1 = (ga1 != null ? ga1.peek() : null);
                    e1 = in.readString();
                    a1.add(e1);
                  }
                }
                m0.put(k0, v0);
              }
            }
          }
          break;

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

        case 5:
          if (in.readIndex() != 1) {
            in.readNull();
            this.filePathsToBeDeletedPerPartition = null;
          } else {
            long size2 = in.readMapStart();
            java.util.Map> m2 = this.filePathsToBeDeletedPerPartition; // Need fresh name due to limitation of macro system
            if (m2 == null) {
              m2 = new java.util.HashMap>((int)size2);
              this.filePathsToBeDeletedPerPartition = m2;
            } else m2.clear();
            for ( ; 0 < size2; size2 = in.mapNext()) {
              for ( ; size2 != 0; size2--) {
                java.lang.String k2 = null;
                k2 = in.readString();
                java.util.List v2 = null;
                long size3 = in.readArrayStart();
                java.util.List a3 = v2;
                if (a3 == null) {
                  a3 = new SpecificData.Array((int)size3, SCHEMA$.getField("filePathsToBeDeletedPerPartition").schema().getTypes().get(1).getValueType());
                  v2 = a3;
                } else a3.clear();
                SpecificData.Array ga3 = (a3 instanceof SpecificData.Array ? (SpecificData.Array)a3 : null);
                for ( ; 0 < size3; size3 = in.arrayNext()) {
                  for ( ; size3 != 0; size3--) {
                    org.apache.hudi.avro.model.HoodieCleanFileInfo e3 = (ga3 != null ? ga3.peek() : null);
                    if (e3 == null) {
                      e3 = new org.apache.hudi.avro.model.HoodieCleanFileInfo();
                    }
                    e3.customDecode(in);
                    a3.add(e3);
                  }
                }
                m2.put(k2, v2);
              }
            }
          }
          break;

        case 6:
          if (in.readIndex() != 1) {
            in.readNull();
            this.partitionsToBeDeleted = null;
          } else {
            long size4 = in.readArrayStart();
            java.util.List a4 = this.partitionsToBeDeleted;
            if (a4 == null) {
              a4 = new SpecificData.Array((int)size4, SCHEMA$.getField("partitionsToBeDeleted").schema().getTypes().get(1));
              this.partitionsToBeDeleted = a4;
            } else a4.clear();
            SpecificData.Array ga4 = (a4 instanceof SpecificData.Array ? (SpecificData.Array)a4 : null);
            for ( ; 0 < size4; size4 = in.arrayNext()) {
              for ( ; size4 != 0; size4--) {
                java.lang.String e4 = (ga4 != null ? ga4.peek() : null);
                e4 = in.readString();
                a4.add(e4);
              }
            }
          }
          break;

        case 7:
          if (in.readIndex() != 1) {
            in.readNull();
            this.extraMetadata = null;
          } else {
            long size5 = in.readMapStart();
            java.util.Map m5 = this.extraMetadata; // Need fresh name due to limitation of macro system
            if (m5 == null) {
              m5 = new java.util.HashMap((int)size5);
              this.extraMetadata = m5;
            } else m5.clear();
            for ( ; 0 < size5; size5 = in.mapNext()) {
              for ( ; size5 != 0; size5--) {
                java.lang.String k5 = null;
                k5 = in.readString();
                java.lang.String v5 = null;
                v5 = in.readString();
                m5.put(k5, v5);
              }
            }
          }
          break;

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














© 2015 - 2025 Weber Informatics LLC | Privacy Policy