SizeStatistics.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.parquet.format;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
/**
 * A structure for capturing metadata for estimating the unencoded,
 * uncompressed size of data written. This is useful for readers to estimate
 * how much memory is needed to reconstruct data in their memory model and for
 * fine grained filter pushdown on nested structures (the histograms contained
 * in this structure can help determine the number of nulls at a particular
 * nesting level and maximum length of lists).
 */
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class SizeStatistics implements org.apache.thrift.TBase<SizeStatistics, SizeStatistics._Fields>, java.io.Serializable, Cloneable, Comparable<SizeStatistics> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SizeStatistics");

  private static final org.apache.thrift.protocol.TField UNENCODED_BYTE_ARRAY_DATA_BYTES_FIELD_DESC = new org.apache.thrift.protocol.TField("unencoded_byte_array_data_bytes", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField REPETITION_LEVEL_HISTOGRAM_FIELD_DESC = new org.apache.thrift.protocol.TField("repetition_level_histogram", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField DEFINITION_LEVEL_HISTOGRAM_FIELD_DESC = new org.apache.thrift.protocol.TField("definition_level_histogram", org.apache.thrift.protocol.TType.LIST, (short)3);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SizeStatisticsStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new SizeStatisticsTupleSchemeFactory();

  /**
   * The number of physical bytes stored for BYTE_ARRAY data values assuming
   * no encoding. This is exclusive of the bytes needed to store the length of
   * each byte array. In other words, this field is equivalent to the `(size
   * of PLAINENCODING the byte array values)  (4 bytes * number of values
   * written)`. To determine unencoded sizes of other types readers can use
   * schema information multiplied by the number of nonnull and null values.
   * The number of null/nonnull values can be inferred from the histograms
   * below.
   * 
   * For example, if a column chunk is dictionaryencoded with dictionary
   * ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2],
   * then this value for that data page should be 7 (1 + 1 + 2 + 3).
   * 
   * This field should only be set for types that use BYTE_ARRAY as their
   * physical type.
   */
  public long unencoded_byte_array_data_bytes; // optional
  /**
   * When present, there is expected to be one element corresponding to each
   * repetition (i.e. size=max repetition_level+1) where each element
   * represents the number of times the repetition level was observed in the
   * data.
   * 
   * This field may be omitted if max_repetition_level is 0 without loss
   * of information.
   * 
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> repetition_level_histogram; // optional
  /**
   * Same as repetition_level_histogram except for definition levels.
   * 
   * This field may be omitted if max_definition_level is 0 or 1 without
   * loss of information.
   * 
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> definition_level_histogram; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     * The number of physical bytes stored for BYTE_ARRAY data values assuming
     * no encoding. This is exclusive of the bytes needed to store the length of
     * each byte array. In other words, this field is equivalent to the `(size
     * of PLAINENCODING the byte array values)  (4 bytes * number of values
     * written)`. To determine unencoded sizes of other types readers can use
     * schema information multiplied by the number of nonnull and null values.
     * The number of null/nonnull values can be inferred from the histograms
     * below.
     * 
     * For example, if a column chunk is dictionaryencoded with dictionary
     * ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2],
     * then this value for that data page should be 7 (1 + 1 + 2 + 3).
     * 
     * This field should only be set for types that use BYTE_ARRAY as their
     * physical type.
     */
    UNENCODED_BYTE_ARRAY_DATA_BYTES((short)1, "unencoded_byte_array_data_bytes"),
    /**
     * When present, there is expected to be one element corresponding to each
     * repetition (i.e. size=max repetition_level+1) where each element
     * represents the number of times the repetition level was observed in the
     * data.
     * 
     * This field may be omitted if max_repetition_level is 0 without loss
     * of information.
     * 
     */
    REPETITION_LEVEL_HISTOGRAM((short)2, "repetition_level_histogram"),
    /**
     * Same as repetition_level_histogram except for definition levels.
     * 
     * This field may be omitted if max_definition_level is 0 or 1 without
     * loss of information.
     * 
     */
    DEFINITION_LEVEL_HISTOGRAM((short)3, "definition_level_histogram");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // UNENCODED_BYTE_ARRAY_DATA_BYTES
          return UNENCODED_BYTE_ARRAY_DATA_BYTES;
        case 2: // REPETITION_LEVEL_HISTOGRAM
          return REPETITION_LEVEL_HISTOGRAM;
        case 3: // DEFINITION_LEVEL_HISTOGRAM
          return DEFINITION_LEVEL_HISTOGRAM;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __UNENCODED_BYTE_ARRAY_DATA_BYTES_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.UNENCODED_BYTE_ARRAY_DATA_BYTES,_Fields.REPETITION_LEVEL_HISTOGRAM,_Fields.DEFINITION_LEVEL_HISTOGRAM};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.UNENCODED_BYTE_ARRAY_DATA_BYTES, new org.apache.thrift.meta_data.FieldMetaData("unencoded_byte_array_data_bytes", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.REPETITION_LEVEL_HISTOGRAM, new org.apache.thrift.meta_data.FieldMetaData("repetition_level_histogram", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    tmpMap.put(_Fields.DEFINITION_LEVEL_HISTOGRAM, new org.apache.thrift.meta_data.FieldMetaData("definition_level_histogram", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SizeStatistics.class, metaDataMap);
  }

  public SizeStatistics() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SizeStatistics(SizeStatistics other) {
    __isset_bitfield = other.__isset_bitfield;
    this.unencoded_byte_array_data_bytes = other.unencoded_byte_array_data_bytes;
    if (other.isSetRepetitionLevelHistogram()) {
      java.util.List<java.lang.Long> __this__repetition_level_histogram = new java.util.ArrayList<java.lang.Long>(other.repetition_level_histogram);
      this.repetition_level_histogram = __this__repetition_level_histogram;
    }
    if (other.isSetDefinitionLevelHistogram()) {
      java.util.List<java.lang.Long> __this__definition_level_histogram = new java.util.ArrayList<java.lang.Long>(other.definition_level_histogram);
      this.definition_level_histogram = __this__definition_level_histogram;
    }
  }

  public SizeStatistics deepCopy() {
    return new SizeStatistics(this);
  }

  @Override
  public void clear() {
    setUnencodedByteArrayDataBytesIsSet(false);
    this.unencoded_byte_array_data_bytes = 0;
    this.repetition_level_histogram = null;
    this.definition_level_histogram = null;
  }

  /**
   * The number of physical bytes stored for BYTE_ARRAY data values assuming
   * no encoding. This is exclusive of the bytes needed to store the length of
   * each byte array. In other words, this field is equivalent to the `(size
   * of PLAINENCODING the byte array values)  (4 bytes * number of values
   * written)`. To determine unencoded sizes of other types readers can use
   * schema information multiplied by the number of nonnull and null values.
   * The number of null/nonnull values can be inferred from the histograms
   * below.
   * 
   * For example, if a column chunk is dictionaryencoded with dictionary
   * ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2],
   * then this value for that data page should be 7 (1 + 1 + 2 + 3).
   * 
   * This field should only be set for types that use BYTE_ARRAY as their
   * physical type.
   */
  public long getUnencodedByteArrayDataBytes() {
    return this.unencoded_byte_array_data_bytes;
  }

  /**
   * The number of physical bytes stored for BYTE_ARRAY data values assuming
   * no encoding. This is exclusive of the bytes needed to store the length of
   * each byte array. In other words, this field is equivalent to the `(size
   * of PLAINENCODING the byte array values)  (4 bytes * number of values
   * written)`. To determine unencoded sizes of other types readers can use
   * schema information multiplied by the number of nonnull and null values.
   * The number of null/nonnull values can be inferred from the histograms
   * below.
   * 
   * For example, if a column chunk is dictionaryencoded with dictionary
   * ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2],
   * then this value for that data page should be 7 (1 + 1 + 2 + 3).
   * 
   * This field should only be set for types that use BYTE_ARRAY as their
   * physical type.
   */
  public SizeStatistics setUnencodedByteArrayDataBytes(long unencoded_byte_array_data_bytes) {
    this.unencoded_byte_array_data_bytes = unencoded_byte_array_data_bytes;
    setUnencodedByteArrayDataBytesIsSet(true);
    return this;
  }

  public void unsetUnencodedByteArrayDataBytes() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __UNENCODED_BYTE_ARRAY_DATA_BYTES_ISSET_ID);
  }

  /** Returns true if field unencoded_byte_array_data_bytes is set (has been assigned a value) and false otherwise */
  public boolean isSetUnencodedByteArrayDataBytes() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __UNENCODED_BYTE_ARRAY_DATA_BYTES_ISSET_ID);
  }

  public void setUnencodedByteArrayDataBytesIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __UNENCODED_BYTE_ARRAY_DATA_BYTES_ISSET_ID, value);
  }

  public int getRepetitionLevelHistogramSize() {
    return (this.repetition_level_histogram == null) ? 0 : this.repetition_level_histogram.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getRepetitionLevelHistogramIterator() {
    return (this.repetition_level_histogram == null) ? null : this.repetition_level_histogram.iterator();
  }

  public void addToRepetitionLevelHistogram(long elem) {
    if (this.repetition_level_histogram == null) {
      this.repetition_level_histogram = new java.util.ArrayList<java.lang.Long>();
    }
    this.repetition_level_histogram.add(elem);
  }

  /**
   * When present, there is expected to be one element corresponding to each
   * repetition (i.e. size=max repetition_level+1) where each element
   * represents the number of times the repetition level was observed in the
   * data.
   * 
   * This field may be omitted if max_repetition_level is 0 without loss
   * of information.
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getRepetitionLevelHistogram() {
    return this.repetition_level_histogram;
  }

  /**
   * When present, there is expected to be one element corresponding to each
   * repetition (i.e. size=max repetition_level+1) where each element
   * represents the number of times the repetition level was observed in the
   * data.
   * 
   * This field may be omitted if max_repetition_level is 0 without loss
   * of information.
   * 
   */
  public SizeStatistics setRepetitionLevelHistogram(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> repetition_level_histogram) {
    this.repetition_level_histogram = repetition_level_histogram;
    return this;
  }

  public void unsetRepetitionLevelHistogram() {
    this.repetition_level_histogram = null;
  }

  /** Returns true if field repetition_level_histogram is set (has been assigned a value) and false otherwise */
  public boolean isSetRepetitionLevelHistogram() {
    return this.repetition_level_histogram != null;
  }

  public void setRepetitionLevelHistogramIsSet(boolean value) {
    if (!value) {
      this.repetition_level_histogram = null;
    }
  }

  public int getDefinitionLevelHistogramSize() {
    return (this.definition_level_histogram == null) ? 0 : this.definition_level_histogram.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.Long> getDefinitionLevelHistogramIterator() {
    return (this.definition_level_histogram == null) ? null : this.definition_level_histogram.iterator();
  }

  public void addToDefinitionLevelHistogram(long elem) {
    if (this.definition_level_histogram == null) {
      this.definition_level_histogram = new java.util.ArrayList<java.lang.Long>();
    }
    this.definition_level_histogram.add(elem);
  }

  /**
   * Same as repetition_level_histogram except for definition levels.
   * 
   * This field may be omitted if max_definition_level is 0 or 1 without
   * loss of information.
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getDefinitionLevelHistogram() {
    return this.definition_level_histogram;
  }

  /**
   * Same as repetition_level_histogram except for definition levels.
   * 
   * This field may be omitted if max_definition_level is 0 or 1 without
   * loss of information.
   * 
   */
  public SizeStatistics setDefinitionLevelHistogram(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> definition_level_histogram) {
    this.definition_level_histogram = definition_level_histogram;
    return this;
  }

  public void unsetDefinitionLevelHistogram() {
    this.definition_level_histogram = null;
  }

  /** Returns true if field definition_level_histogram is set (has been assigned a value) and false otherwise */
  public boolean isSetDefinitionLevelHistogram() {
    return this.definition_level_histogram != null;
  }

  public void setDefinitionLevelHistogramIsSet(boolean value) {
    if (!value) {
      this.definition_level_histogram = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case UNENCODED_BYTE_ARRAY_DATA_BYTES:
      if (value == null) {
        unsetUnencodedByteArrayDataBytes();
      } else {
        setUnencodedByteArrayDataBytes((java.lang.Long)value);
      }
      break;

    case REPETITION_LEVEL_HISTOGRAM:
      if (value == null) {
        unsetRepetitionLevelHistogram();
      } else {
        setRepetitionLevelHistogram((java.util.List<java.lang.Long>)value);
      }
      break;

    case DEFINITION_LEVEL_HISTOGRAM:
      if (value == null) {
        unsetDefinitionLevelHistogram();
      } else {
        setDefinitionLevelHistogram((java.util.List<java.lang.Long>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case UNENCODED_BYTE_ARRAY_DATA_BYTES:
      return getUnencodedByteArrayDataBytes();

    case REPETITION_LEVEL_HISTOGRAM:
      return getRepetitionLevelHistogram();

    case DEFINITION_LEVEL_HISTOGRAM:
      return getDefinitionLevelHistogram();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case UNENCODED_BYTE_ARRAY_DATA_BYTES:
      return isSetUnencodedByteArrayDataBytes();
    case REPETITION_LEVEL_HISTOGRAM:
      return isSetRepetitionLevelHistogram();
    case DEFINITION_LEVEL_HISTOGRAM:
      return isSetDefinitionLevelHistogram();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof SizeStatistics)
      return this.equals((SizeStatistics)that);
    return false;
  }

  public boolean equals(SizeStatistics that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_unencoded_byte_array_data_bytes = true && this.isSetUnencodedByteArrayDataBytes();
    boolean that_present_unencoded_byte_array_data_bytes = true && that.isSetUnencodedByteArrayDataBytes();
    if (this_present_unencoded_byte_array_data_bytes || that_present_unencoded_byte_array_data_bytes) {
      if (!(this_present_unencoded_byte_array_data_bytes && that_present_unencoded_byte_array_data_bytes))
        return false;
      if (this.unencoded_byte_array_data_bytes != that.unencoded_byte_array_data_bytes)
        return false;
    }

    boolean this_present_repetition_level_histogram = true && this.isSetRepetitionLevelHistogram();
    boolean that_present_repetition_level_histogram = true && that.isSetRepetitionLevelHistogram();
    if (this_present_repetition_level_histogram || that_present_repetition_level_histogram) {
      if (!(this_present_repetition_level_histogram && that_present_repetition_level_histogram))
        return false;
      if (!this.repetition_level_histogram.equals(that.repetition_level_histogram))
        return false;
    }

    boolean this_present_definition_level_histogram = true && this.isSetDefinitionLevelHistogram();
    boolean that_present_definition_level_histogram = true && that.isSetDefinitionLevelHistogram();
    if (this_present_definition_level_histogram || that_present_definition_level_histogram) {
      if (!(this_present_definition_level_histogram && that_present_definition_level_histogram))
        return false;
      if (!this.definition_level_histogram.equals(that.definition_level_histogram))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetUnencodedByteArrayDataBytes()) ? 131071 : 524287);
    if (isSetUnencodedByteArrayDataBytes())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(unencoded_byte_array_data_bytes);

    hashCode = hashCode * 8191 + ((isSetRepetitionLevelHistogram()) ? 131071 : 524287);
    if (isSetRepetitionLevelHistogram())
      hashCode = hashCode * 8191 + repetition_level_histogram.hashCode();

    hashCode = hashCode * 8191 + ((isSetDefinitionLevelHistogram()) ? 131071 : 524287);
    if (isSetDefinitionLevelHistogram())
      hashCode = hashCode * 8191 + definition_level_histogram.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(SizeStatistics other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetUnencodedByteArrayDataBytes(), other.isSetUnencodedByteArrayDataBytes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUnencodedByteArrayDataBytes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unencoded_byte_array_data_bytes, other.unencoded_byte_array_data_bytes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRepetitionLevelHistogram(), other.isSetRepetitionLevelHistogram());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRepetitionLevelHistogram()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.repetition_level_histogram, other.repetition_level_histogram);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDefinitionLevelHistogram(), other.isSetDefinitionLevelHistogram());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDefinitionLevelHistogram()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.definition_level_histogram, other.definition_level_histogram);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("SizeStatistics(");
    boolean first = true;

    if (isSetUnencodedByteArrayDataBytes()) {
      sb.append("unencoded_byte_array_data_bytes:");
      sb.append(this.unencoded_byte_array_data_bytes);
      first = false;
    }
    if (isSetRepetitionLevelHistogram()) {
      if (!first) sb.append(", ");
      sb.append("repetition_level_histogram:");
      if (this.repetition_level_histogram == null) {
        sb.append("null");
      } else {
        sb.append(this.repetition_level_histogram);
      }
      first = false;
    }
    if (isSetDefinitionLevelHistogram()) {
      if (!first) sb.append(", ");
      sb.append("definition_level_histogram:");
      if (this.definition_level_histogram == null) {
        sb.append("null");
      } else {
        sb.append(this.definition_level_histogram);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class SizeStatisticsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public SizeStatisticsStandardScheme getScheme() {
      return new SizeStatisticsStandardScheme();
    }
  }

  private static class SizeStatisticsStandardScheme extends org.apache.thrift.scheme.StandardScheme<SizeStatistics> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SizeStatistics struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // UNENCODED_BYTE_ARRAY_DATA_BYTES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.unencoded_byte_array_data_bytes = iprot.readI64();
              struct.setUnencodedByteArrayDataBytesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // REPETITION_LEVEL_HISTOGRAM
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.repetition_level_histogram = new java.util.ArrayList<java.lang.Long>(_list0.size);
                long _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                {
                  _elem1 = iprot.readI64();
                  struct.repetition_level_histogram.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setRepetitionLevelHistogramIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DEFINITION_LEVEL_HISTOGRAM
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list3 = iprot.readListBegin();
                struct.definition_level_histogram = new java.util.ArrayList<java.lang.Long>(_list3.size);
                long _elem4;
                for (int _i5 = 0; _i5 < _list3.size; ++_i5)
                {
                  _elem4 = iprot.readI64();
                  struct.definition_level_histogram.add(_elem4);
                }
                iprot.readListEnd();
              }
              struct.setDefinitionLevelHistogramIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, SizeStatistics struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.isSetUnencodedByteArrayDataBytes()) {
        oprot.writeFieldBegin(UNENCODED_BYTE_ARRAY_DATA_BYTES_FIELD_DESC);
        oprot.writeI64(struct.unencoded_byte_array_data_bytes);
        oprot.writeFieldEnd();
      }
      if (struct.repetition_level_histogram != null) {
        if (struct.isSetRepetitionLevelHistogram()) {
          oprot.writeFieldBegin(REPETITION_LEVEL_HISTOGRAM_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.repetition_level_histogram.size()));
            for (long _iter6 : struct.repetition_level_histogram)
            {
              oprot.writeI64(_iter6);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.definition_level_histogram != null) {
        if (struct.isSetDefinitionLevelHistogram()) {
          oprot.writeFieldBegin(DEFINITION_LEVEL_HISTOGRAM_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.definition_level_histogram.size()));
            for (long _iter7 : struct.definition_level_histogram)
            {
              oprot.writeI64(_iter7);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SizeStatisticsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public SizeStatisticsTupleScheme getScheme() {
      return new SizeStatisticsTupleScheme();
    }
  }

  private static class SizeStatisticsTupleScheme extends org.apache.thrift.scheme.TupleScheme<SizeStatistics> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SizeStatistics struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetUnencodedByteArrayDataBytes()) {
        optionals.set(0);
      }
      if (struct.isSetRepetitionLevelHistogram()) {
        optionals.set(1);
      }
      if (struct.isSetDefinitionLevelHistogram()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetUnencodedByteArrayDataBytes()) {
        oprot.writeI64(struct.unencoded_byte_array_data_bytes);
      }
      if (struct.isSetRepetitionLevelHistogram()) {
        {
          oprot.writeI32(struct.repetition_level_histogram.size());
          for (long _iter8 : struct.repetition_level_histogram)
          {
            oprot.writeI64(_iter8);
          }
        }
      }
      if (struct.isSetDefinitionLevelHistogram()) {
        {
          oprot.writeI32(struct.definition_level_histogram.size());
          for (long _iter9 : struct.definition_level_histogram)
          {
            oprot.writeI64(_iter9);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SizeStatistics struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.unencoded_byte_array_data_bytes = iprot.readI64();
        struct.setUnencodedByteArrayDataBytesIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list10 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.repetition_level_histogram = new java.util.ArrayList<java.lang.Long>(_list10.size);
          long _elem11;
          for (int _i12 = 0; _i12 < _list10.size; ++_i12)
          {
            _elem11 = iprot.readI64();
            struct.repetition_level_histogram.add(_elem11);
          }
        }
        struct.setRepetitionLevelHistogramIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list13 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.definition_level_histogram = new java.util.ArrayList<java.lang.Long>(_list13.size);
          long _elem14;
          for (int _i15 = 0; _i15 < _list13.size; ++_i15)
          {
            _elem14 = iprot.readI64();
            struct.definition_level_histogram.add(_elem14);
          }
        }
        struct.setDefinitionLevelHistogramIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}