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

org.apache.hudi.avro.model.HoodieCompactionWriteStat 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 HoodieCompactionWriteStat extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 717998176418697036L;
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"HoodieCompactionWriteStat\",\"namespace\":\"org.apache.hudi.avro.model\",\"fields\":[{\"name\":\"partitionPath\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"totalLogRecords\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalLogFiles\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalUpdatedRecordsCompacted\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"hoodieWriteStat\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"HoodieWriteStat\",\"fields\":[{\"name\":\"fileId\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"path\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"prevCommit\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"numWrites\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"numDeletes\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"numUpdateWrites\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalWriteBytes\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalWriteErrors\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"partitionPath\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"totalLogRecords\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalLogFiles\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalUpdatedRecordsCompacted\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"numInserts\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalLogBlocks\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalCorruptLogBlock\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"totalRollbackBlocks\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"fileSizeInBytes\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"logVersion\",\"type\":[\"null\",\"int\"],\"default\":null},{\"name\":\"logOffset\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"baseFile\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"default\":null},{\"name\":\"logFiles\",\"type\":[\"null\",{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":null}],\"default\":null},{\"name\":\"cdcStats\",\"type\":[\"null\",{\"type\":\"map\",\"values\":\"long\",\"avro.java.string\":\"String\",\"default\":null}],\"default\":null}]}],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static 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 HoodieCompactionWriteStat 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 HoodieCompactionWriteStat from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a HoodieCompactionWriteStat 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 HoodieCompactionWriteStat fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

   private java.lang.String partitionPath;
   private java.lang.Long totalLogRecords;
   private java.lang.Long totalLogFiles;
   private java.lang.Long totalUpdatedRecordsCompacted;
   private org.apache.hudi.avro.model.HoodieWriteStat hoodieWriteStat;

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

  /**
   * All-args constructor.
   * @param partitionPath The new value for partitionPath
   * @param totalLogRecords The new value for totalLogRecords
   * @param totalLogFiles The new value for totalLogFiles
   * @param totalUpdatedRecordsCompacted The new value for totalUpdatedRecordsCompacted
   * @param hoodieWriteStat The new value for hoodieWriteStat
   */
  public HoodieCompactionWriteStat(java.lang.String partitionPath, java.lang.Long totalLogRecords, java.lang.Long totalLogFiles, java.lang.Long totalUpdatedRecordsCompacted, org.apache.hudi.avro.model.HoodieWriteStat hoodieWriteStat) {
    this.partitionPath = partitionPath;
    this.totalLogRecords = totalLogRecords;
    this.totalLogFiles = totalLogFiles;
    this.totalUpdatedRecordsCompacted = totalUpdatedRecordsCompacted;
    this.hoodieWriteStat = hoodieWriteStat;
  }

  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return partitionPath;
    case 1: return totalLogRecords;
    case 2: return totalLogFiles;
    case 3: return totalUpdatedRecordsCompacted;
    case 4: return hoodieWriteStat;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: partitionPath = value$ != null ? value$.toString() : null; break;
    case 1: totalLogRecords = (java.lang.Long)value$; break;
    case 2: totalLogFiles = (java.lang.Long)value$; break;
    case 3: totalUpdatedRecordsCompacted = (java.lang.Long)value$; break;
    case 4: hoodieWriteStat = (org.apache.hudi.avro.model.HoodieWriteStat)value$; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

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


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

  /**
   * Gets the value of the 'totalLogRecords' field.
   * @return The value of the 'totalLogRecords' field.
   */
  public java.lang.Long getTotalLogRecords() {
    return totalLogRecords;
  }


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

  /**
   * Gets the value of the 'totalLogFiles' field.
   * @return The value of the 'totalLogFiles' field.
   */
  public java.lang.Long getTotalLogFiles() {
    return totalLogFiles;
  }


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

  /**
   * Gets the value of the 'totalUpdatedRecordsCompacted' field.
   * @return The value of the 'totalUpdatedRecordsCompacted' field.
   */
  public java.lang.Long getTotalUpdatedRecordsCompacted() {
    return totalUpdatedRecordsCompacted;
  }


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

  /**
   * Gets the value of the 'hoodieWriteStat' field.
   * @return The value of the 'hoodieWriteStat' field.
   */
  public org.apache.hudi.avro.model.HoodieWriteStat getHoodieWriteStat() {
    return hoodieWriteStat;
  }


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

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

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

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

  /**
   * RecordBuilder for HoodieCompactionWriteStat 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 partitionPath;
    private java.lang.Long totalLogRecords;
    private java.lang.Long totalLogFiles;
    private java.lang.Long totalUpdatedRecordsCompacted;
    private org.apache.hudi.avro.model.HoodieWriteStat hoodieWriteStat;
    private org.apache.hudi.avro.model.HoodieWriteStat.Builder hoodieWriteStatBuilder;

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

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(org.apache.hudi.avro.model.HoodieCompactionWriteStat.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.partitionPath)) {
        this.partitionPath = data().deepCopy(fields()[0].schema(), other.partitionPath);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (isValidValue(fields()[1], other.totalLogRecords)) {
        this.totalLogRecords = data().deepCopy(fields()[1].schema(), other.totalLogRecords);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.totalLogFiles)) {
        this.totalLogFiles = data().deepCopy(fields()[2].schema(), other.totalLogFiles);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.totalUpdatedRecordsCompacted)) {
        this.totalUpdatedRecordsCompacted = data().deepCopy(fields()[3].schema(), other.totalUpdatedRecordsCompacted);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (isValidValue(fields()[4], other.hoodieWriteStat)) {
        this.hoodieWriteStat = data().deepCopy(fields()[4].schema(), other.hoodieWriteStat);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (other.hasHoodieWriteStatBuilder()) {
        this.hoodieWriteStatBuilder = org.apache.hudi.avro.model.HoodieWriteStat.newBuilder(other.getHoodieWriteStatBuilder());
      }
    }

    /**
     * Creates a Builder by copying an existing HoodieCompactionWriteStat instance
     * @param other The existing instance to copy.
     */
    private Builder(org.apache.hudi.avro.model.HoodieCompactionWriteStat other) {
      super(SCHEMA$);
      if (isValidValue(fields()[0], other.partitionPath)) {
        this.partitionPath = data().deepCopy(fields()[0].schema(), other.partitionPath);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.totalLogRecords)) {
        this.totalLogRecords = data().deepCopy(fields()[1].schema(), other.totalLogRecords);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.totalLogFiles)) {
        this.totalLogFiles = data().deepCopy(fields()[2].schema(), other.totalLogFiles);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.totalUpdatedRecordsCompacted)) {
        this.totalUpdatedRecordsCompacted = data().deepCopy(fields()[3].schema(), other.totalUpdatedRecordsCompacted);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.hoodieWriteStat)) {
        this.hoodieWriteStat = data().deepCopy(fields()[4].schema(), other.hoodieWriteStat);
        fieldSetFlags()[4] = true;
      }
      this.hoodieWriteStatBuilder = null;
    }

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


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

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


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

    /**
      * Gets the value of the 'totalLogRecords' field.
      * @return The value.
      */
    public java.lang.Long getTotalLogRecords() {
      return totalLogRecords;
    }


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

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


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

    /**
      * Gets the value of the 'totalLogFiles' field.
      * @return The value.
      */
    public java.lang.Long getTotalLogFiles() {
      return totalLogFiles;
    }


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

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


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

    /**
      * Gets the value of the 'totalUpdatedRecordsCompacted' field.
      * @return The value.
      */
    public java.lang.Long getTotalUpdatedRecordsCompacted() {
      return totalUpdatedRecordsCompacted;
    }


    /**
      * Sets the value of the 'totalUpdatedRecordsCompacted' field.
      * @param value The value of 'totalUpdatedRecordsCompacted'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCompactionWriteStat.Builder setTotalUpdatedRecordsCompacted(java.lang.Long value) {
      validate(fields()[3], value);
      this.totalUpdatedRecordsCompacted = value;
      fieldSetFlags()[3] = true;
      return this;
    }

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


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

    /**
      * Gets the value of the 'hoodieWriteStat' field.
      * @return The value.
      */
    public org.apache.hudi.avro.model.HoodieWriteStat getHoodieWriteStat() {
      return hoodieWriteStat;
    }


    /**
      * Sets the value of the 'hoodieWriteStat' field.
      * @param value The value of 'hoodieWriteStat'.
      * @return This builder.
      */
    public org.apache.hudi.avro.model.HoodieCompactionWriteStat.Builder setHoodieWriteStat(org.apache.hudi.avro.model.HoodieWriteStat value) {
      validate(fields()[4], value);
      this.hoodieWriteStatBuilder = null;
      this.hoodieWriteStat = value;
      fieldSetFlags()[4] = true;
      return this;
    }

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

    /**
     * Gets the Builder instance for the 'hoodieWriteStat' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public org.apache.hudi.avro.model.HoodieWriteStat.Builder getHoodieWriteStatBuilder() {
      if (hoodieWriteStatBuilder == null) {
        if (hasHoodieWriteStat()) {
          setHoodieWriteStatBuilder(org.apache.hudi.avro.model.HoodieWriteStat.newBuilder(hoodieWriteStat));
        } else {
          setHoodieWriteStatBuilder(org.apache.hudi.avro.model.HoodieWriteStat.newBuilder());
        }
      }
      return hoodieWriteStatBuilder;
    }

    /**
     * Sets the Builder instance for the 'hoodieWriteStat' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */
    public org.apache.hudi.avro.model.HoodieCompactionWriteStat.Builder setHoodieWriteStatBuilder(org.apache.hudi.avro.model.HoodieWriteStat.Builder value) {
      clearHoodieWriteStat();
      hoodieWriteStatBuilder = value;
      return this;
    }

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

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

    @Override
    @SuppressWarnings("unchecked")
    public HoodieCompactionWriteStat build() {
      try {
        HoodieCompactionWriteStat record = new HoodieCompactionWriteStat();
        record.partitionPath = fieldSetFlags()[0] ? this.partitionPath : (java.lang.String) defaultValue(fields()[0]);
        record.totalLogRecords = fieldSetFlags()[1] ? this.totalLogRecords : (java.lang.Long) defaultValue(fields()[1]);
        record.totalLogFiles = fieldSetFlags()[2] ? this.totalLogFiles : (java.lang.Long) defaultValue(fields()[2]);
        record.totalUpdatedRecordsCompacted = fieldSetFlags()[3] ? this.totalUpdatedRecordsCompacted : (java.lang.Long) defaultValue(fields()[3]);
        if (hoodieWriteStatBuilder != null) {
          try {
            record.hoodieWriteStat = this.hoodieWriteStatBuilder.build();
          } catch (org.apache.avro.AvroMissingFieldException e) {
            e.addParentField(record.getSchema().getField("hoodieWriteStat"));
            throw e;
          }
        } else {
          record.hoodieWriteStat = fieldSetFlags()[4] ? this.hoodieWriteStat : (org.apache.hudi.avro.model.HoodieWriteStat) defaultValue(fields()[4]);
        }
        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.partitionPath == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      out.writeString(this.partitionPath);
    }

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

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

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

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

  }

  @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.partitionPath = null;
      } else {
        this.partitionPath = in.readString();
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.totalLogRecords = null;
      } else {
        this.totalLogRecords = in.readLong();
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.totalLogFiles = null;
      } else {
        this.totalLogFiles = in.readLong();
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.totalUpdatedRecordsCompacted = null;
      } else {
        this.totalUpdatedRecordsCompacted = in.readLong();
      }

      if (in.readIndex() != 1) {
        in.readNull();
        this.hoodieWriteStat = null;
      } else {
        if (this.hoodieWriteStat == null) {
          this.hoodieWriteStat = new org.apache.hudi.avro.model.HoodieWriteStat();
        }
        this.hoodieWriteStat.customDecode(in);
      }

    } else {
      for (int i = 0; i < 5; i++) {
        switch (fieldOrder[i].pos()) {
        case 0:
          if (in.readIndex() != 1) {
            in.readNull();
            this.partitionPath = null;
          } else {
            this.partitionPath = in.readString();
          }
          break;

        case 1:
          if (in.readIndex() != 1) {
            in.readNull();
            this.totalLogRecords = null;
          } else {
            this.totalLogRecords = in.readLong();
          }
          break;

        case 2:
          if (in.readIndex() != 1) {
            in.readNull();
            this.totalLogFiles = null;
          } else {
            this.totalLogFiles = in.readLong();
          }
          break;

        case 3:
          if (in.readIndex() != 1) {
            in.readNull();
            this.totalUpdatedRecordsCompacted = null;
          } else {
            this.totalUpdatedRecordsCompacted = in.readLong();
          }
          break;

        case 4:
          if (in.readIndex() != 1) {
            in.readNull();
            this.hoodieWriteStat = null;
          } else {
            if (this.hoodieWriteStat == null) {
              this.hoodieWriteStat = new org.apache.hudi.avro.model.HoodieWriteStat();
            }
            this.hoodieWriteStat.customDecode(in);
          }
          break;

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














© 2015 - 2024 Weber Informatics LLC | Privacy Policy