ColumnIndex.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"})
/**
 * Optional statistics for each data page in a ColumnChunk.
 * 
 * Forms part the page index, along with OffsetIndex.
 * 
 * If this structure is present, OffsetIndex must also be present.
 * 
 * For each field in this structure, <field>[i] refers to the page at
 * OffsetIndex.page_locations[i]
 */
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class ColumnIndex implements org.apache.thrift.TBase<ColumnIndex, ColumnIndex._Fields>, java.io.Serializable, Cloneable, Comparable<ColumnIndex> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ColumnIndex");

  private static final org.apache.thrift.protocol.TField NULL_PAGES_FIELD_DESC = new org.apache.thrift.protocol.TField("null_pages", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField MIN_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("min_values", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField MAX_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("max_values", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField BOUNDARY_ORDER_FIELD_DESC = new org.apache.thrift.protocol.TField("boundary_order", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField NULL_COUNTS_FIELD_DESC = new org.apache.thrift.protocol.TField("null_counts", org.apache.thrift.protocol.TType.LIST, (short)5);
  private static final org.apache.thrift.protocol.TField REPETITION_LEVEL_HISTOGRAMS_FIELD_DESC = new org.apache.thrift.protocol.TField("repetition_level_histograms", org.apache.thrift.protocol.TType.LIST, (short)6);
  private static final org.apache.thrift.protocol.TField DEFINITION_LEVEL_HISTOGRAMS_FIELD_DESC = new org.apache.thrift.protocol.TField("definition_level_histograms", org.apache.thrift.protocol.TType.LIST, (short)7);

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

  /**
   * A list of Boolean values to determine the validity of the corresponding
   * min and max values. If true, a page contains only null values, and writers
   * have to set the corresponding entries in min_values and max_values to
   * byte[0], so that all lists have the same length. If false, the
   * corresponding entries in min_values and max_values must be valid.
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> null_pages; // required
  /**
   * Two lists containing lower and upper bounds for the values of each page
   * determined by the ColumnOrder of the column. These may be the actual
   * minimum and maximum values found on a page, but can also be (more compact)
   * values that do not exist on a page. For example, instead of storing ""Blart
   * Versenwald III", a writer may set min_values[i]="B", max_values[i]="C".
   * Such more compact values must still be valid values within the column's
   * logical type. Readers must make sure that list entries are populated before
   * using them by inspecting null_pages.
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> min_values; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> max_values; // required
  /**
   * Stores whether both min_values and max_values are ordered and if so, in
   * which direction. This allows readers to perform binary searches in both
   * lists. Readers cannot assume that max_values[i] <= min_values[i+1], even
   * if the lists are ordered.
   * 
   * @see BoundaryOrder
   */
  public @org.apache.thrift.annotation.Nullable BoundaryOrder boundary_order; // required
  /**
   * A list containing the number of null values for each page
   * 
   * Writers SHOULD always write this field even if no null values
   * are present or the column is not nullable.
   * Readers MUST distinguish between null_counts not being present
   * and null_count being 0.
   * If null_counts are not present, readers MUST NOT assume all
   * null counts are 0.
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> null_counts; // optional
  /**
   * Contains repetition level histograms for each page
   * concatenated together.  The repetition_level_histogram field on
   * SizeStatistics contains more details.
   * 
   * When present the length should always be (number of pages *
   * (max_repetition_level + 1)) elements.
   * 
   * Element 0 is the first element of the histogram for the first page.
   * Element (max_repetition_level + 1) is the first element of the histogram
   * for the second page.
   * 
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> repetition_level_histograms; // optional
  /**
   * Same as repetition_level_histograms except for definitions levels.
   * 
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> definition_level_histograms; // 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 {
    /**
     * A list of Boolean values to determine the validity of the corresponding
     * min and max values. If true, a page contains only null values, and writers
     * have to set the corresponding entries in min_values and max_values to
     * byte[0], so that all lists have the same length. If false, the
     * corresponding entries in min_values and max_values must be valid.
     */
    NULL_PAGES((short)1, "null_pages"),
    /**
     * Two lists containing lower and upper bounds for the values of each page
     * determined by the ColumnOrder of the column. These may be the actual
     * minimum and maximum values found on a page, but can also be (more compact)
     * values that do not exist on a page. For example, instead of storing ""Blart
     * Versenwald III", a writer may set min_values[i]="B", max_values[i]="C".
     * Such more compact values must still be valid values within the column's
     * logical type. Readers must make sure that list entries are populated before
     * using them by inspecting null_pages.
     */
    MIN_VALUES((short)2, "min_values"),
    MAX_VALUES((short)3, "max_values"),
    /**
     * Stores whether both min_values and max_values are ordered and if so, in
     * which direction. This allows readers to perform binary searches in both
     * lists. Readers cannot assume that max_values[i] <= min_values[i+1], even
     * if the lists are ordered.
     * 
     * @see BoundaryOrder
     */
    BOUNDARY_ORDER((short)4, "boundary_order"),
    /**
     * A list containing the number of null values for each page
     * 
     * Writers SHOULD always write this field even if no null values
     * are present or the column is not nullable.
     * Readers MUST distinguish between null_counts not being present
     * and null_count being 0.
     * If null_counts are not present, readers MUST NOT assume all
     * null counts are 0.
     */
    NULL_COUNTS((short)5, "null_counts"),
    /**
     * Contains repetition level histograms for each page
     * concatenated together.  The repetition_level_histogram field on
     * SizeStatistics contains more details.
     * 
     * When present the length should always be (number of pages *
     * (max_repetition_level + 1)) elements.
     * 
     * Element 0 is the first element of the histogram for the first page.
     * Element (max_repetition_level + 1) is the first element of the histogram
     * for the second page.
     * 
     */
    REPETITION_LEVEL_HISTOGRAMS((short)6, "repetition_level_histograms"),
    /**
     * Same as repetition_level_histograms except for definitions levels.
     * 
     */
    DEFINITION_LEVEL_HISTOGRAMS((short)7, "definition_level_histograms");

    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: // NULL_PAGES
          return NULL_PAGES;
        case 2: // MIN_VALUES
          return MIN_VALUES;
        case 3: // MAX_VALUES
          return MAX_VALUES;
        case 4: // BOUNDARY_ORDER
          return BOUNDARY_ORDER;
        case 5: // NULL_COUNTS
          return NULL_COUNTS;
        case 6: // REPETITION_LEVEL_HISTOGRAMS
          return REPETITION_LEVEL_HISTOGRAMS;
        case 7: // DEFINITION_LEVEL_HISTOGRAMS
          return DEFINITION_LEVEL_HISTOGRAMS;
        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 _Fields optionals[] = {_Fields.NULL_COUNTS,_Fields.REPETITION_LEVEL_HISTOGRAMS,_Fields.DEFINITION_LEVEL_HISTOGRAMS};
  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.NULL_PAGES, new org.apache.thrift.meta_data.FieldMetaData("null_pages", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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.BOOL))));
    tmpMap.put(_Fields.MIN_VALUES, new org.apache.thrift.meta_data.FieldMetaData("min_values", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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.STRING            , true))));
    tmpMap.put(_Fields.MAX_VALUES, new org.apache.thrift.meta_data.FieldMetaData("max_values", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        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.STRING            , true))));
    tmpMap.put(_Fields.BOUNDARY_ORDER, new org.apache.thrift.meta_data.FieldMetaData("boundary_order", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, BoundaryOrder.class)));
    tmpMap.put(_Fields.NULL_COUNTS, new org.apache.thrift.meta_data.FieldMetaData("null_counts", 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.REPETITION_LEVEL_HISTOGRAMS, new org.apache.thrift.meta_data.FieldMetaData("repetition_level_histograms", 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_HISTOGRAMS, new org.apache.thrift.meta_data.FieldMetaData("definition_level_histograms", 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(ColumnIndex.class, metaDataMap);
  }

  public ColumnIndex() {
  }

  public ColumnIndex(
    java.util.List<java.lang.Boolean> null_pages,
    java.util.List<java.nio.ByteBuffer> min_values,
    java.util.List<java.nio.ByteBuffer> max_values,
    BoundaryOrder boundary_order)
  {
    this();
    this.null_pages = null_pages;
    this.min_values = min_values;
    this.max_values = max_values;
    this.boundary_order = boundary_order;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public ColumnIndex(ColumnIndex other) {
    if (other.isSetNullPages()) {
      java.util.List<java.lang.Boolean> __this__null_pages = new java.util.ArrayList<java.lang.Boolean>(other.null_pages);
      this.null_pages = __this__null_pages;
    }
    if (other.isSetMinValues()) {
      java.util.List<java.nio.ByteBuffer> __this__min_values = new java.util.ArrayList<java.nio.ByteBuffer>(other.min_values);
      this.min_values = __this__min_values;
    }
    if (other.isSetMaxValues()) {
      java.util.List<java.nio.ByteBuffer> __this__max_values = new java.util.ArrayList<java.nio.ByteBuffer>(other.max_values);
      this.max_values = __this__max_values;
    }
    if (other.isSetBoundaryOrder()) {
      this.boundary_order = other.boundary_order;
    }
    if (other.isSetNullCounts()) {
      java.util.List<java.lang.Long> __this__null_counts = new java.util.ArrayList<java.lang.Long>(other.null_counts);
      this.null_counts = __this__null_counts;
    }
    if (other.isSetRepetitionLevelHistograms()) {
      java.util.List<java.lang.Long> __this__repetition_level_histograms = new java.util.ArrayList<java.lang.Long>(other.repetition_level_histograms);
      this.repetition_level_histograms = __this__repetition_level_histograms;
    }
    if (other.isSetDefinitionLevelHistograms()) {
      java.util.List<java.lang.Long> __this__definition_level_histograms = new java.util.ArrayList<java.lang.Long>(other.definition_level_histograms);
      this.definition_level_histograms = __this__definition_level_histograms;
    }
  }

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

  @Override
  public void clear() {
    this.null_pages = null;
    this.min_values = null;
    this.max_values = null;
    this.boundary_order = null;
    this.null_counts = null;
    this.repetition_level_histograms = null;
    this.definition_level_histograms = null;
  }

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

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

  public void addToNullPages(boolean elem) {
    if (this.null_pages == null) {
      this.null_pages = new java.util.ArrayList<java.lang.Boolean>();
    }
    this.null_pages.add(elem);
  }

  /**
   * A list of Boolean values to determine the validity of the corresponding
   * min and max values. If true, a page contains only null values, and writers
   * have to set the corresponding entries in min_values and max_values to
   * byte[0], so that all lists have the same length. If false, the
   * corresponding entries in min_values and max_values must be valid.
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Boolean> getNullPages() {
    return this.null_pages;
  }

  /**
   * A list of Boolean values to determine the validity of the corresponding
   * min and max values. If true, a page contains only null values, and writers
   * have to set the corresponding entries in min_values and max_values to
   * byte[0], so that all lists have the same length. If false, the
   * corresponding entries in min_values and max_values must be valid.
   */
  public ColumnIndex setNullPages(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Boolean> null_pages) {
    this.null_pages = null_pages;
    return this;
  }

  public void unsetNullPages() {
    this.null_pages = null;
  }

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

  public void setNullPagesIsSet(boolean value) {
    if (!value) {
      this.null_pages = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.nio.ByteBuffer> getMinValuesIterator() {
    return (this.min_values == null) ? null : this.min_values.iterator();
  }

  public void addToMinValues(java.nio.ByteBuffer elem) {
    if (this.min_values == null) {
      this.min_values = new java.util.ArrayList<java.nio.ByteBuffer>();
    }
    this.min_values.add(elem);
  }

  /**
   * Two lists containing lower and upper bounds for the values of each page
   * determined by the ColumnOrder of the column. These may be the actual
   * minimum and maximum values found on a page, but can also be (more compact)
   * values that do not exist on a page. For example, instead of storing ""Blart
   * Versenwald III", a writer may set min_values[i]="B", max_values[i]="C".
   * Such more compact values must still be valid values within the column's
   * logical type. Readers must make sure that list entries are populated before
   * using them by inspecting null_pages.
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.nio.ByteBuffer> getMinValues() {
    return this.min_values;
  }

  /**
   * Two lists containing lower and upper bounds for the values of each page
   * determined by the ColumnOrder of the column. These may be the actual
   * minimum and maximum values found on a page, but can also be (more compact)
   * values that do not exist on a page. For example, instead of storing ""Blart
   * Versenwald III", a writer may set min_values[i]="B", max_values[i]="C".
   * Such more compact values must still be valid values within the column's
   * logical type. Readers must make sure that list entries are populated before
   * using them by inspecting null_pages.
   */
  public ColumnIndex setMinValues(@org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> min_values) {
    this.min_values = min_values;
    return this;
  }

  public void unsetMinValues() {
    this.min_values = null;
  }

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

  public void setMinValuesIsSet(boolean value) {
    if (!value) {
      this.min_values = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.nio.ByteBuffer> getMaxValuesIterator() {
    return (this.max_values == null) ? null : this.max_values.iterator();
  }

  public void addToMaxValues(java.nio.ByteBuffer elem) {
    if (this.max_values == null) {
      this.max_values = new java.util.ArrayList<java.nio.ByteBuffer>();
    }
    this.max_values.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.nio.ByteBuffer> getMaxValues() {
    return this.max_values;
  }

  public ColumnIndex setMaxValues(@org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> max_values) {
    this.max_values = max_values;
    return this;
  }

  public void unsetMaxValues() {
    this.max_values = null;
  }

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

  public void setMaxValuesIsSet(boolean value) {
    if (!value) {
      this.max_values = null;
    }
  }

  /**
   * Stores whether both min_values and max_values are ordered and if so, in
   * which direction. This allows readers to perform binary searches in both
   * lists. Readers cannot assume that max_values[i] <= min_values[i+1], even
   * if the lists are ordered.
   * 
   * @see BoundaryOrder
   */
  @org.apache.thrift.annotation.Nullable
  public BoundaryOrder getBoundaryOrder() {
    return this.boundary_order;
  }

  /**
   * Stores whether both min_values and max_values are ordered and if so, in
   * which direction. This allows readers to perform binary searches in both
   * lists. Readers cannot assume that max_values[i] <= min_values[i+1], even
   * if the lists are ordered.
   * 
   * @see BoundaryOrder
   */
  public ColumnIndex setBoundaryOrder(@org.apache.thrift.annotation.Nullable BoundaryOrder boundary_order) {
    this.boundary_order = boundary_order;
    return this;
  }

  public void unsetBoundaryOrder() {
    this.boundary_order = null;
  }

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

  public void setBoundaryOrderIsSet(boolean value) {
    if (!value) {
      this.boundary_order = null;
    }
  }

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

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

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

  /**
   * A list containing the number of null values for each page
   * 
   * Writers SHOULD always write this field even if no null values
   * are present or the column is not nullable.
   * Readers MUST distinguish between null_counts not being present
   * and null_count being 0.
   * If null_counts are not present, readers MUST NOT assume all
   * null counts are 0.
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getNullCounts() {
    return this.null_counts;
  }

  /**
   * A list containing the number of null values for each page
   * 
   * Writers SHOULD always write this field even if no null values
   * are present or the column is not nullable.
   * Readers MUST distinguish between null_counts not being present
   * and null_count being 0.
   * If null_counts are not present, readers MUST NOT assume all
   * null counts are 0.
   */
  public ColumnIndex setNullCounts(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> null_counts) {
    this.null_counts = null_counts;
    return this;
  }

  public void unsetNullCounts() {
    this.null_counts = null;
  }

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

  public void setNullCountsIsSet(boolean value) {
    if (!value) {
      this.null_counts = null;
    }
  }

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

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

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

  /**
   * Contains repetition level histograms for each page
   * concatenated together.  The repetition_level_histogram field on
   * SizeStatistics contains more details.
   * 
   * When present the length should always be (number of pages *
   * (max_repetition_level + 1)) elements.
   * 
   * Element 0 is the first element of the histogram for the first page.
   * Element (max_repetition_level + 1) is the first element of the histogram
   * for the second page.
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getRepetitionLevelHistograms() {
    return this.repetition_level_histograms;
  }

  /**
   * Contains repetition level histograms for each page
   * concatenated together.  The repetition_level_histogram field on
   * SizeStatistics contains more details.
   * 
   * When present the length should always be (number of pages *
   * (max_repetition_level + 1)) elements.
   * 
   * Element 0 is the first element of the histogram for the first page.
   * Element (max_repetition_level + 1) is the first element of the histogram
   * for the second page.
   * 
   */
  public ColumnIndex setRepetitionLevelHistograms(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> repetition_level_histograms) {
    this.repetition_level_histograms = repetition_level_histograms;
    return this;
  }

  public void unsetRepetitionLevelHistograms() {
    this.repetition_level_histograms = null;
  }

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

  public void setRepetitionLevelHistogramsIsSet(boolean value) {
    if (!value) {
      this.repetition_level_histograms = null;
    }
  }

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

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

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

  /**
   * Same as repetition_level_histograms except for definitions levels.
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.Long> getDefinitionLevelHistograms() {
    return this.definition_level_histograms;
  }

  /**
   * Same as repetition_level_histograms except for definitions levels.
   * 
   */
  public ColumnIndex setDefinitionLevelHistograms(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.Long> definition_level_histograms) {
    this.definition_level_histograms = definition_level_histograms;
    return this;
  }

  public void unsetDefinitionLevelHistograms() {
    this.definition_level_histograms = null;
  }

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

  public void setDefinitionLevelHistogramsIsSet(boolean value) {
    if (!value) {
      this.definition_level_histograms = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case NULL_PAGES:
      if (value == null) {
        unsetNullPages();
      } else {
        setNullPages((java.util.List<java.lang.Boolean>)value);
      }
      break;

    case MIN_VALUES:
      if (value == null) {
        unsetMinValues();
      } else {
        setMinValues((java.util.List<java.nio.ByteBuffer>)value);
      }
      break;

    case MAX_VALUES:
      if (value == null) {
        unsetMaxValues();
      } else {
        setMaxValues((java.util.List<java.nio.ByteBuffer>)value);
      }
      break;

    case BOUNDARY_ORDER:
      if (value == null) {
        unsetBoundaryOrder();
      } else {
        setBoundaryOrder((BoundaryOrder)value);
      }
      break;

    case NULL_COUNTS:
      if (value == null) {
        unsetNullCounts();
      } else {
        setNullCounts((java.util.List<java.lang.Long>)value);
      }
      break;

    case REPETITION_LEVEL_HISTOGRAMS:
      if (value == null) {
        unsetRepetitionLevelHistograms();
      } else {
        setRepetitionLevelHistograms((java.util.List<java.lang.Long>)value);
      }
      break;

    case DEFINITION_LEVEL_HISTOGRAMS:
      if (value == null) {
        unsetDefinitionLevelHistograms();
      } else {
        setDefinitionLevelHistograms((java.util.List<java.lang.Long>)value);
      }
      break;

    }
  }

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

    case MIN_VALUES:
      return getMinValues();

    case MAX_VALUES:
      return getMaxValues();

    case BOUNDARY_ORDER:
      return getBoundaryOrder();

    case NULL_COUNTS:
      return getNullCounts();

    case REPETITION_LEVEL_HISTOGRAMS:
      return getRepetitionLevelHistograms();

    case DEFINITION_LEVEL_HISTOGRAMS:
      return getDefinitionLevelHistograms();

    }
    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 NULL_PAGES:
      return isSetNullPages();
    case MIN_VALUES:
      return isSetMinValues();
    case MAX_VALUES:
      return isSetMaxValues();
    case BOUNDARY_ORDER:
      return isSetBoundaryOrder();
    case NULL_COUNTS:
      return isSetNullCounts();
    case REPETITION_LEVEL_HISTOGRAMS:
      return isSetRepetitionLevelHistograms();
    case DEFINITION_LEVEL_HISTOGRAMS:
      return isSetDefinitionLevelHistograms();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_null_pages = true && this.isSetNullPages();
    boolean that_present_null_pages = true && that.isSetNullPages();
    if (this_present_null_pages || that_present_null_pages) {
      if (!(this_present_null_pages && that_present_null_pages))
        return false;
      if (!this.null_pages.equals(that.null_pages))
        return false;
    }

    boolean this_present_min_values = true && this.isSetMinValues();
    boolean that_present_min_values = true && that.isSetMinValues();
    if (this_present_min_values || that_present_min_values) {
      if (!(this_present_min_values && that_present_min_values))
        return false;
      if (!this.min_values.equals(that.min_values))
        return false;
    }

    boolean this_present_max_values = true && this.isSetMaxValues();
    boolean that_present_max_values = true && that.isSetMaxValues();
    if (this_present_max_values || that_present_max_values) {
      if (!(this_present_max_values && that_present_max_values))
        return false;
      if (!this.max_values.equals(that.max_values))
        return false;
    }

    boolean this_present_boundary_order = true && this.isSetBoundaryOrder();
    boolean that_present_boundary_order = true && that.isSetBoundaryOrder();
    if (this_present_boundary_order || that_present_boundary_order) {
      if (!(this_present_boundary_order && that_present_boundary_order))
        return false;
      if (!this.boundary_order.equals(that.boundary_order))
        return false;
    }

    boolean this_present_null_counts = true && this.isSetNullCounts();
    boolean that_present_null_counts = true && that.isSetNullCounts();
    if (this_present_null_counts || that_present_null_counts) {
      if (!(this_present_null_counts && that_present_null_counts))
        return false;
      if (!this.null_counts.equals(that.null_counts))
        return false;
    }

    boolean this_present_repetition_level_histograms = true && this.isSetRepetitionLevelHistograms();
    boolean that_present_repetition_level_histograms = true && that.isSetRepetitionLevelHistograms();
    if (this_present_repetition_level_histograms || that_present_repetition_level_histograms) {
      if (!(this_present_repetition_level_histograms && that_present_repetition_level_histograms))
        return false;
      if (!this.repetition_level_histograms.equals(that.repetition_level_histograms))
        return false;
    }

    boolean this_present_definition_level_histograms = true && this.isSetDefinitionLevelHistograms();
    boolean that_present_definition_level_histograms = true && that.isSetDefinitionLevelHistograms();
    if (this_present_definition_level_histograms || that_present_definition_level_histograms) {
      if (!(this_present_definition_level_histograms && that_present_definition_level_histograms))
        return false;
      if (!this.definition_level_histograms.equals(that.definition_level_histograms))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetNullPages()) ? 131071 : 524287);
    if (isSetNullPages())
      hashCode = hashCode * 8191 + null_pages.hashCode();

    hashCode = hashCode * 8191 + ((isSetMinValues()) ? 131071 : 524287);
    if (isSetMinValues())
      hashCode = hashCode * 8191 + min_values.hashCode();

    hashCode = hashCode * 8191 + ((isSetMaxValues()) ? 131071 : 524287);
    if (isSetMaxValues())
      hashCode = hashCode * 8191 + max_values.hashCode();

    hashCode = hashCode * 8191 + ((isSetBoundaryOrder()) ? 131071 : 524287);
    if (isSetBoundaryOrder())
      hashCode = hashCode * 8191 + boundary_order.getValue();

    hashCode = hashCode * 8191 + ((isSetNullCounts()) ? 131071 : 524287);
    if (isSetNullCounts())
      hashCode = hashCode * 8191 + null_counts.hashCode();

    hashCode = hashCode * 8191 + ((isSetRepetitionLevelHistograms()) ? 131071 : 524287);
    if (isSetRepetitionLevelHistograms())
      hashCode = hashCode * 8191 + repetition_level_histograms.hashCode();

    hashCode = hashCode * 8191 + ((isSetDefinitionLevelHistograms()) ? 131071 : 524287);
    if (isSetDefinitionLevelHistograms())
      hashCode = hashCode * 8191 + definition_level_histograms.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetNullPages(), other.isSetNullPages());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNullPages()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_pages, other.null_pages);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMinValues(), other.isSetMinValues());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMinValues()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.min_values, other.min_values);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetMaxValues(), other.isSetMaxValues());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMaxValues()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max_values, other.max_values);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBoundaryOrder(), other.isSetBoundaryOrder());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBoundaryOrder()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.boundary_order, other.boundary_order);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetNullCounts(), other.isSetNullCounts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNullCounts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_counts, other.null_counts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRepetitionLevelHistograms(), other.isSetRepetitionLevelHistograms());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRepetitionLevelHistograms()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.repetition_level_histograms, other.repetition_level_histograms);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDefinitionLevelHistograms(), other.isSetDefinitionLevelHistograms());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDefinitionLevelHistograms()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.definition_level_histograms, other.definition_level_histograms);
      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("ColumnIndex(");
    boolean first = true;

    sb.append("null_pages:");
    if (this.null_pages == null) {
      sb.append("null");
    } else {
      sb.append(this.null_pages);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("min_values:");
    if (this.min_values == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.min_values, sb);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("max_values:");
    if (this.max_values == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.max_values, sb);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("boundary_order:");
    if (this.boundary_order == null) {
      sb.append("null");
    } else {
      sb.append(this.boundary_order);
    }
    first = false;
    if (isSetNullCounts()) {
      if (!first) sb.append(", ");
      sb.append("null_counts:");
      if (this.null_counts == null) {
        sb.append("null");
      } else {
        sb.append(this.null_counts);
      }
      first = false;
    }
    if (isSetRepetitionLevelHistograms()) {
      if (!first) sb.append(", ");
      sb.append("repetition_level_histograms:");
      if (this.repetition_level_histograms == null) {
        sb.append("null");
      } else {
        sb.append(this.repetition_level_histograms);
      }
      first = false;
    }
    if (isSetDefinitionLevelHistograms()) {
      if (!first) sb.append(", ");
      sb.append("definition_level_histograms:");
      if (this.definition_level_histograms == null) {
        sb.append("null");
      } else {
        sb.append(this.definition_level_histograms);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (null_pages == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'null_pages' was not present! Struct: " + toString());
    }
    if (min_values == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'min_values' was not present! Struct: " + toString());
    }
    if (max_values == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'max_values' was not present! Struct: " + toString());
    }
    if (boundary_order == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'boundary_order' was not present! Struct: " + toString());
    }
    // 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 {
      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 ColumnIndexStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public ColumnIndexStandardScheme getScheme() {
      return new ColumnIndexStandardScheme();
    }
  }

  private static class ColumnIndexStandardScheme extends org.apache.thrift.scheme.StandardScheme<ColumnIndex> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, ColumnIndex 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: // NULL_PAGES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list96 = iprot.readListBegin();
                struct.null_pages = new java.util.ArrayList<java.lang.Boolean>(_list96.size);
                boolean _elem97;
                for (int _i98 = 0; _i98 < _list96.size; ++_i98)
                {
                  _elem97 = iprot.readBool();
                  struct.null_pages.add(_elem97);
                }
                iprot.readListEnd();
              }
              struct.setNullPagesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MIN_VALUES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list99 = iprot.readListBegin();
                struct.min_values = new java.util.ArrayList<java.nio.ByteBuffer>(_list99.size);
                @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem100;
                for (int _i101 = 0; _i101 < _list99.size; ++_i101)
                {
                  _elem100 = iprot.readBinary();
                  struct.min_values.add(_elem100);
                }
                iprot.readListEnd();
              }
              struct.setMinValuesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // MAX_VALUES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list102 = iprot.readListBegin();
                struct.max_values = new java.util.ArrayList<java.nio.ByteBuffer>(_list102.size);
                @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem103;
                for (int _i104 = 0; _i104 < _list102.size; ++_i104)
                {
                  _elem103 = iprot.readBinary();
                  struct.max_values.add(_elem103);
                }
                iprot.readListEnd();
              }
              struct.setMaxValuesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // BOUNDARY_ORDER
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.boundary_order = org.apache.parquet.format.BoundaryOrder.findByValue(iprot.readI32());
              struct.setBoundaryOrderIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // NULL_COUNTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list105 = iprot.readListBegin();
                struct.null_counts = new java.util.ArrayList<java.lang.Long>(_list105.size);
                long _elem106;
                for (int _i107 = 0; _i107 < _list105.size; ++_i107)
                {
                  _elem106 = iprot.readI64();
                  struct.null_counts.add(_elem106);
                }
                iprot.readListEnd();
              }
              struct.setNullCountsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // REPETITION_LEVEL_HISTOGRAMS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list108 = iprot.readListBegin();
                struct.repetition_level_histograms = new java.util.ArrayList<java.lang.Long>(_list108.size);
                long _elem109;
                for (int _i110 = 0; _i110 < _list108.size; ++_i110)
                {
                  _elem109 = iprot.readI64();
                  struct.repetition_level_histograms.add(_elem109);
                }
                iprot.readListEnd();
              }
              struct.setRepetitionLevelHistogramsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // DEFINITION_LEVEL_HISTOGRAMS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list111 = iprot.readListBegin();
                struct.definition_level_histograms = new java.util.ArrayList<java.lang.Long>(_list111.size);
                long _elem112;
                for (int _i113 = 0; _i113 < _list111.size; ++_i113)
                {
                  _elem112 = iprot.readI64();
                  struct.definition_level_histograms.add(_elem112);
                }
                iprot.readListEnd();
              }
              struct.setDefinitionLevelHistogramsIsSet(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, ColumnIndex struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.null_pages != null) {
        oprot.writeFieldBegin(NULL_PAGES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.null_pages.size()));
          for (boolean _iter114 : struct.null_pages)
          {
            oprot.writeBool(_iter114);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.min_values != null) {
        oprot.writeFieldBegin(MIN_VALUES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.min_values.size()));
          for (java.nio.ByteBuffer _iter115 : struct.min_values)
          {
            oprot.writeBinary(_iter115);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.max_values != null) {
        oprot.writeFieldBegin(MAX_VALUES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.max_values.size()));
          for (java.nio.ByteBuffer _iter116 : struct.max_values)
          {
            oprot.writeBinary(_iter116);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.boundary_order != null) {
        oprot.writeFieldBegin(BOUNDARY_ORDER_FIELD_DESC);
        oprot.writeI32(struct.boundary_order.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.null_counts != null) {
        if (struct.isSetNullCounts()) {
          oprot.writeFieldBegin(NULL_COUNTS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.null_counts.size()));
            for (long _iter117 : struct.null_counts)
            {
              oprot.writeI64(_iter117);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.repetition_level_histograms != null) {
        if (struct.isSetRepetitionLevelHistograms()) {
          oprot.writeFieldBegin(REPETITION_LEVEL_HISTOGRAMS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.repetition_level_histograms.size()));
            for (long _iter118 : struct.repetition_level_histograms)
            {
              oprot.writeI64(_iter118);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.definition_level_histograms != null) {
        if (struct.isSetDefinitionLevelHistograms()) {
          oprot.writeFieldBegin(DEFINITION_LEVEL_HISTOGRAMS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.definition_level_histograms.size()));
            for (long _iter119 : struct.definition_level_histograms)
            {
              oprot.writeI64(_iter119);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class ColumnIndexTupleScheme extends org.apache.thrift.scheme.TupleScheme<ColumnIndex> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ColumnIndex struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.null_pages.size());
        for (boolean _iter120 : struct.null_pages)
        {
          oprot.writeBool(_iter120);
        }
      }
      {
        oprot.writeI32(struct.min_values.size());
        for (java.nio.ByteBuffer _iter121 : struct.min_values)
        {
          oprot.writeBinary(_iter121);
        }
      }
      {
        oprot.writeI32(struct.max_values.size());
        for (java.nio.ByteBuffer _iter122 : struct.max_values)
        {
          oprot.writeBinary(_iter122);
        }
      }
      oprot.writeI32(struct.boundary_order.getValue());
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetNullCounts()) {
        optionals.set(0);
      }
      if (struct.isSetRepetitionLevelHistograms()) {
        optionals.set(1);
      }
      if (struct.isSetDefinitionLevelHistograms()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetNullCounts()) {
        {
          oprot.writeI32(struct.null_counts.size());
          for (long _iter123 : struct.null_counts)
          {
            oprot.writeI64(_iter123);
          }
        }
      }
      if (struct.isSetRepetitionLevelHistograms()) {
        {
          oprot.writeI32(struct.repetition_level_histograms.size());
          for (long _iter124 : struct.repetition_level_histograms)
          {
            oprot.writeI64(_iter124);
          }
        }
      }
      if (struct.isSetDefinitionLevelHistograms()) {
        {
          oprot.writeI32(struct.definition_level_histograms.size());
          for (long _iter125 : struct.definition_level_histograms)
          {
            oprot.writeI64(_iter125);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ColumnIndex struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(org.apache.thrift.protocol.TType.BOOL);
        struct.null_pages = new java.util.ArrayList<java.lang.Boolean>(_list126.size);
        boolean _elem127;
        for (int _i128 = 0; _i128 < _list126.size; ++_i128)
        {
          _elem127 = iprot.readBool();
          struct.null_pages.add(_elem127);
        }
      }
      struct.setNullPagesIsSet(true);
      {
        org.apache.thrift.protocol.TList _list129 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
        struct.min_values = new java.util.ArrayList<java.nio.ByteBuffer>(_list129.size);
        @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem130;
        for (int _i131 = 0; _i131 < _list129.size; ++_i131)
        {
          _elem130 = iprot.readBinary();
          struct.min_values.add(_elem130);
        }
      }
      struct.setMinValuesIsSet(true);
      {
        org.apache.thrift.protocol.TList _list132 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
        struct.max_values = new java.util.ArrayList<java.nio.ByteBuffer>(_list132.size);
        @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem133;
        for (int _i134 = 0; _i134 < _list132.size; ++_i134)
        {
          _elem133 = iprot.readBinary();
          struct.max_values.add(_elem133);
        }
      }
      struct.setMaxValuesIsSet(true);
      struct.boundary_order = org.apache.parquet.format.BoundaryOrder.findByValue(iprot.readI32());
      struct.setBoundaryOrderIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list135 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.null_counts = new java.util.ArrayList<java.lang.Long>(_list135.size);
          long _elem136;
          for (int _i137 = 0; _i137 < _list135.size; ++_i137)
          {
            _elem136 = iprot.readI64();
            struct.null_counts.add(_elem136);
          }
        }
        struct.setNullCountsIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list138 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.repetition_level_histograms = new java.util.ArrayList<java.lang.Long>(_list138.size);
          long _elem139;
          for (int _i140 = 0; _i140 < _list138.size; ++_i140)
          {
            _elem139 = iprot.readI64();
            struct.repetition_level_histograms.add(_elem139);
          }
        }
        struct.setRepetitionLevelHistogramsIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list141 = iprot.readListBegin(org.apache.thrift.protocol.TType.I64);
          struct.definition_level_histograms = new java.util.ArrayList<java.lang.Long>(_list141.size);
          long _elem142;
          for (int _i143 = 0; _i143 < _list141.size; ++_i143)
          {
            _elem142 = iprot.readI64();
            struct.definition_level_histograms.add(_elem142);
          }
        }
        struct.setDefinitionLevelHistogramsIsSet(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();
  }
}