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

org.apache.parquet.format.RowGroup Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.13.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"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-09-30")
public class RowGroup implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RowGroup");

  private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField TOTAL_BYTE_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("total_byte_size", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField NUM_ROWS_FIELD_DESC = new org.apache.thrift.protocol.TField("num_rows", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField SORTING_COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("sorting_columns", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField FILE_OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("file_offset", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField TOTAL_COMPRESSED_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("total_compressed_size", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField ORDINAL_FIELD_DESC = new org.apache.thrift.protocol.TField("ordinal", org.apache.thrift.protocol.TType.I16, (short)7);

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

  /**
   * Metadata for each column chunk in this row group.
   * This list must have the same order as the SchemaElement list in FileMetaData.
   * 
   */
  public @org.apache.thrift.annotation.Nullable java.util.List columns; // required
  /**
   * Total byte size of all the uncompressed column data in this row group *
   */
  public long total_byte_size; // required
  /**
   * Number of rows in this row group *
   */
  public long num_rows; // required
  /**
   * If set, specifies a sort ordering of the rows in this RowGroup.
   * The sorting columns can be a subset of all the columns.
   */
  public @org.apache.thrift.annotation.Nullable java.util.List sorting_columns; // optional
  /**
   * Byte offset from beginning of file to first page (data or dictionary)
   * in this row group *
   */
  public long file_offset; // optional
  /**
   * Total byte size of all compressed (and potentially encrypted) column data
   * in this row group *
   */
  public long total_compressed_size; // optional
  /**
   * Row group ordinal in the file *
   */
  public short ordinal; // 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 {
    /**
     * Metadata for each column chunk in this row group.
     * This list must have the same order as the SchemaElement list in FileMetaData.
     * 
     */
    COLUMNS((short)1, "columns"),
    /**
     * Total byte size of all the uncompressed column data in this row group *
     */
    TOTAL_BYTE_SIZE((short)2, "total_byte_size"),
    /**
     * Number of rows in this row group *
     */
    NUM_ROWS((short)3, "num_rows"),
    /**
     * If set, specifies a sort ordering of the rows in this RowGroup.
     * The sorting columns can be a subset of all the columns.
     */
    SORTING_COLUMNS((short)4, "sorting_columns"),
    /**
     * Byte offset from beginning of file to first page (data or dictionary)
     * in this row group *
     */
    FILE_OFFSET((short)5, "file_offset"),
    /**
     * Total byte size of all compressed (and potentially encrypted) column data
     * in this row group *
     */
    TOTAL_COMPRESSED_SIZE((short)6, "total_compressed_size"),
    /**
     * Row group ordinal in the file *
     */
    ORDINAL((short)7, "ordinal");

    private static final java.util.Map byName = new java.util.HashMap();

    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: // COLUMNS
          return COLUMNS;
        case 2: // TOTAL_BYTE_SIZE
          return TOTAL_BYTE_SIZE;
        case 3: // NUM_ROWS
          return NUM_ROWS;
        case 4: // SORTING_COLUMNS
          return SORTING_COLUMNS;
        case 5: // FILE_OFFSET
          return FILE_OFFSET;
        case 6: // TOTAL_COMPRESSED_SIZE
          return TOTAL_COMPRESSED_SIZE;
        case 7: // ORDINAL
          return ORDINAL;
        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 __TOTAL_BYTE_SIZE_ISSET_ID = 0;
  private static final int __NUM_ROWS_ISSET_ID = 1;
  private static final int __FILE_OFFSET_ISSET_ID = 2;
  private static final int __TOTAL_COMPRESSED_SIZE_ISSET_ID = 3;
  private static final int __ORDINAL_ISSET_ID = 4;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.SORTING_COLUMNS,_Fields.FILE_OFFSET,_Fields.TOTAL_COMPRESSED_SIZE,_Fields.ORDINAL};
  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.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnChunk.class))));
    tmpMap.put(_Fields.TOTAL_BYTE_SIZE, new org.apache.thrift.meta_data.FieldMetaData("total_byte_size", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.NUM_ROWS, new org.apache.thrift.meta_data.FieldMetaData("num_rows", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SORTING_COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("sorting_columns", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SortingColumn.class))));
    tmpMap.put(_Fields.FILE_OFFSET, new org.apache.thrift.meta_data.FieldMetaData("file_offset", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TOTAL_COMPRESSED_SIZE, new org.apache.thrift.meta_data.FieldMetaData("total_compressed_size", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ORDINAL, new org.apache.thrift.meta_data.FieldMetaData("ordinal", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RowGroup.class, metaDataMap);
  }

  public RowGroup() {
  }

  public RowGroup(
    java.util.List columns,
    long total_byte_size,
    long num_rows)
  {
    this();
    this.columns = columns;
    this.total_byte_size = total_byte_size;
    setTotal_byte_sizeIsSet(true);
    this.num_rows = num_rows;
    setNum_rowsIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public RowGroup(RowGroup other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetColumns()) {
      java.util.List __this__columns = new java.util.ArrayList(other.columns.size());
      for (ColumnChunk other_element : other.columns) {
        __this__columns.add(new ColumnChunk(other_element));
      }
      this.columns = __this__columns;
    }
    this.total_byte_size = other.total_byte_size;
    this.num_rows = other.num_rows;
    if (other.isSetSorting_columns()) {
      java.util.List __this__sorting_columns = new java.util.ArrayList(other.sorting_columns.size());
      for (SortingColumn other_element : other.sorting_columns) {
        __this__sorting_columns.add(new SortingColumn(other_element));
      }
      this.sorting_columns = __this__sorting_columns;
    }
    this.file_offset = other.file_offset;
    this.total_compressed_size = other.total_compressed_size;
    this.ordinal = other.ordinal;
  }

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

  @Override
  public void clear() {
    this.columns = null;
    setTotal_byte_sizeIsSet(false);
    this.total_byte_size = 0;
    setNum_rowsIsSet(false);
    this.num_rows = 0;
    this.sorting_columns = null;
    setFile_offsetIsSet(false);
    this.file_offset = 0;
    setTotal_compressed_sizeIsSet(false);
    this.total_compressed_size = 0;
    setOrdinalIsSet(false);
    this.ordinal = 0;
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator getColumnsIterator() {
    return (this.columns == null) ? null : this.columns.iterator();
  }

  public void addToColumns(ColumnChunk elem) {
    if (this.columns == null) {
      this.columns = new java.util.ArrayList();
    }
    this.columns.add(elem);
  }

  /**
   * Metadata for each column chunk in this row group.
   * This list must have the same order as the SchemaElement list in FileMetaData.
   * 
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List getColumns() {
    return this.columns;
  }

  /**
   * Metadata for each column chunk in this row group.
   * This list must have the same order as the SchemaElement list in FileMetaData.
   * 
   */
  public RowGroup setColumns(@org.apache.thrift.annotation.Nullable java.util.List columns) {
    this.columns = columns;
    return this;
  }

  public void unsetColumns() {
    this.columns = null;
  }

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

  public void setColumnsIsSet(boolean value) {
    if (!value) {
      this.columns = null;
    }
  }

  /**
   * Total byte size of all the uncompressed column data in this row group *
   */
  public long getTotal_byte_size() {
    return this.total_byte_size;
  }

  /**
   * Total byte size of all the uncompressed column data in this row group *
   */
  public RowGroup setTotal_byte_size(long total_byte_size) {
    this.total_byte_size = total_byte_size;
    setTotal_byte_sizeIsSet(true);
    return this;
  }

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

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

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

  /**
   * Number of rows in this row group *
   */
  public long getNum_rows() {
    return this.num_rows;
  }

  /**
   * Number of rows in this row group *
   */
  public RowGroup setNum_rows(long num_rows) {
    this.num_rows = num_rows;
    setNum_rowsIsSet(true);
    return this;
  }

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

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator getSorting_columnsIterator() {
    return (this.sorting_columns == null) ? null : this.sorting_columns.iterator();
  }

  public void addToSorting_columns(SortingColumn elem) {
    if (this.sorting_columns == null) {
      this.sorting_columns = new java.util.ArrayList();
    }
    this.sorting_columns.add(elem);
  }

  /**
   * If set, specifies a sort ordering of the rows in this RowGroup.
   * The sorting columns can be a subset of all the columns.
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List getSorting_columns() {
    return this.sorting_columns;
  }

  /**
   * If set, specifies a sort ordering of the rows in this RowGroup.
   * The sorting columns can be a subset of all the columns.
   */
  public RowGroup setSorting_columns(@org.apache.thrift.annotation.Nullable java.util.List sorting_columns) {
    this.sorting_columns = sorting_columns;
    return this;
  }

  public void unsetSorting_columns() {
    this.sorting_columns = null;
  }

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

  public void setSorting_columnsIsSet(boolean value) {
    if (!value) {
      this.sorting_columns = null;
    }
  }

  /**
   * Byte offset from beginning of file to first page (data or dictionary)
   * in this row group *
   */
  public long getFile_offset() {
    return this.file_offset;
  }

  /**
   * Byte offset from beginning of file to first page (data or dictionary)
   * in this row group *
   */
  public RowGroup setFile_offset(long file_offset) {
    this.file_offset = file_offset;
    setFile_offsetIsSet(true);
    return this;
  }

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

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

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

  /**
   * Total byte size of all compressed (and potentially encrypted) column data
   * in this row group *
   */
  public long getTotal_compressed_size() {
    return this.total_compressed_size;
  }

  /**
   * Total byte size of all compressed (and potentially encrypted) column data
   * in this row group *
   */
  public RowGroup setTotal_compressed_size(long total_compressed_size) {
    this.total_compressed_size = total_compressed_size;
    setTotal_compressed_sizeIsSet(true);
    return this;
  }

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

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

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

  /**
   * Row group ordinal in the file *
   */
  public short getOrdinal() {
    return this.ordinal;
  }

  /**
   * Row group ordinal in the file *
   */
  public RowGroup setOrdinal(short ordinal) {
    this.ordinal = ordinal;
    setOrdinalIsSet(true);
    return this;
  }

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

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

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

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case COLUMNS:
      if (value == null) {
        unsetColumns();
      } else {
        setColumns((java.util.List)value);
      }
      break;

    case TOTAL_BYTE_SIZE:
      if (value == null) {
        unsetTotal_byte_size();
      } else {
        setTotal_byte_size((java.lang.Long)value);
      }
      break;

    case NUM_ROWS:
      if (value == null) {
        unsetNum_rows();
      } else {
        setNum_rows((java.lang.Long)value);
      }
      break;

    case SORTING_COLUMNS:
      if (value == null) {
        unsetSorting_columns();
      } else {
        setSorting_columns((java.util.List)value);
      }
      break;

    case FILE_OFFSET:
      if (value == null) {
        unsetFile_offset();
      } else {
        setFile_offset((java.lang.Long)value);
      }
      break;

    case TOTAL_COMPRESSED_SIZE:
      if (value == null) {
        unsetTotal_compressed_size();
      } else {
        setTotal_compressed_size((java.lang.Long)value);
      }
      break;

    case ORDINAL:
      if (value == null) {
        unsetOrdinal();
      } else {
        setOrdinal((java.lang.Short)value);
      }
      break;

    }
  }

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

    case TOTAL_BYTE_SIZE:
      return getTotal_byte_size();

    case NUM_ROWS:
      return getNum_rows();

    case SORTING_COLUMNS:
      return getSorting_columns();

    case FILE_OFFSET:
      return getFile_offset();

    case TOTAL_COMPRESSED_SIZE:
      return getTotal_compressed_size();

    case ORDINAL:
      return getOrdinal();

    }
    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 COLUMNS:
      return isSetColumns();
    case TOTAL_BYTE_SIZE:
      return isSetTotal_byte_size();
    case NUM_ROWS:
      return isSetNum_rows();
    case SORTING_COLUMNS:
      return isSetSorting_columns();
    case FILE_OFFSET:
      return isSetFile_offset();
    case TOTAL_COMPRESSED_SIZE:
      return isSetTotal_compressed_size();
    case ORDINAL:
      return isSetOrdinal();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_columns = true && this.isSetColumns();
    boolean that_present_columns = true && that.isSetColumns();
    if (this_present_columns || that_present_columns) {
      if (!(this_present_columns && that_present_columns))
        return false;
      if (!this.columns.equals(that.columns))
        return false;
    }

    boolean this_present_total_byte_size = true;
    boolean that_present_total_byte_size = true;
    if (this_present_total_byte_size || that_present_total_byte_size) {
      if (!(this_present_total_byte_size && that_present_total_byte_size))
        return false;
      if (this.total_byte_size != that.total_byte_size)
        return false;
    }

    boolean this_present_num_rows = true;
    boolean that_present_num_rows = true;
    if (this_present_num_rows || that_present_num_rows) {
      if (!(this_present_num_rows && that_present_num_rows))
        return false;
      if (this.num_rows != that.num_rows)
        return false;
    }

    boolean this_present_sorting_columns = true && this.isSetSorting_columns();
    boolean that_present_sorting_columns = true && that.isSetSorting_columns();
    if (this_present_sorting_columns || that_present_sorting_columns) {
      if (!(this_present_sorting_columns && that_present_sorting_columns))
        return false;
      if (!this.sorting_columns.equals(that.sorting_columns))
        return false;
    }

    boolean this_present_file_offset = true && this.isSetFile_offset();
    boolean that_present_file_offset = true && that.isSetFile_offset();
    if (this_present_file_offset || that_present_file_offset) {
      if (!(this_present_file_offset && that_present_file_offset))
        return false;
      if (this.file_offset != that.file_offset)
        return false;
    }

    boolean this_present_total_compressed_size = true && this.isSetTotal_compressed_size();
    boolean that_present_total_compressed_size = true && that.isSetTotal_compressed_size();
    if (this_present_total_compressed_size || that_present_total_compressed_size) {
      if (!(this_present_total_compressed_size && that_present_total_compressed_size))
        return false;
      if (this.total_compressed_size != that.total_compressed_size)
        return false;
    }

    boolean this_present_ordinal = true && this.isSetOrdinal();
    boolean that_present_ordinal = true && that.isSetOrdinal();
    if (this_present_ordinal || that_present_ordinal) {
      if (!(this_present_ordinal && that_present_ordinal))
        return false;
      if (this.ordinal != that.ordinal)
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetColumns()) ? 131071 : 524287);
    if (isSetColumns())
      hashCode = hashCode * 8191 + columns.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(total_byte_size);

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(num_rows);

    hashCode = hashCode * 8191 + ((isSetSorting_columns()) ? 131071 : 524287);
    if (isSetSorting_columns())
      hashCode = hashCode * 8191 + sorting_columns.hashCode();

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

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

    hashCode = hashCode * 8191 + ((isSetOrdinal()) ? 131071 : 524287);
    if (isSetOrdinal())
      hashCode = hashCode * 8191 + ordinal;

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetColumns()).compareTo(other.isSetColumns());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColumns()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetTotal_byte_size()).compareTo(other.isSetTotal_byte_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotal_byte_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_byte_size, other.total_byte_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetNum_rows()).compareTo(other.isSetNum_rows());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNum_rows()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_rows, other.num_rows);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSorting_columns()).compareTo(other.isSetSorting_columns());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSorting_columns()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sorting_columns, other.sorting_columns);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetFile_offset()).compareTo(other.isSetFile_offset());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFile_offset()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.file_offset, other.file_offset);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetTotal_compressed_size()).compareTo(other.isSetTotal_compressed_size());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTotal_compressed_size()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_compressed_size, other.total_compressed_size);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetOrdinal()).compareTo(other.isSetOrdinal());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrdinal()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ordinal, other.ordinal);
      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("RowGroup(");
    boolean first = true;

    sb.append("columns:");
    if (this.columns == null) {
      sb.append("null");
    } else {
      sb.append(this.columns);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("total_byte_size:");
    sb.append(this.total_byte_size);
    first = false;
    if (!first) sb.append(", ");
    sb.append("num_rows:");
    sb.append(this.num_rows);
    first = false;
    if (isSetSorting_columns()) {
      if (!first) sb.append(", ");
      sb.append("sorting_columns:");
      if (this.sorting_columns == null) {
        sb.append("null");
      } else {
        sb.append(this.sorting_columns);
      }
      first = false;
    }
    if (isSetFile_offset()) {
      if (!first) sb.append(", ");
      sb.append("file_offset:");
      sb.append(this.file_offset);
      first = false;
    }
    if (isSetTotal_compressed_size()) {
      if (!first) sb.append(", ");
      sb.append("total_compressed_size:");
      sb.append(this.total_compressed_size);
      first = false;
    }
    if (isSetOrdinal()) {
      if (!first) sb.append(", ");
      sb.append("ordinal:");
      sb.append(this.ordinal);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (columns == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'total_byte_size' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'num_rows' because it's a primitive and you chose the non-beans generator.
    // 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 RowGroupStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public RowGroupStandardScheme getScheme() {
      return new RowGroupStandardScheme();
    }
  }

  private static class RowGroupStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, RowGroup 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: // COLUMNS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
                struct.columns = new java.util.ArrayList(_list40.size);
                @org.apache.thrift.annotation.Nullable ColumnChunk _elem41;
                for (int _i42 = 0; _i42 < _list40.size; ++_i42)
                {
                  _elem41 = new ColumnChunk();
                  _elem41.read(iprot);
                  struct.columns.add(_elem41);
                }
                iprot.readListEnd();
              }
              struct.setColumnsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TOTAL_BYTE_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.total_byte_size = iprot.readI64();
              struct.setTotal_byte_sizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NUM_ROWS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.num_rows = iprot.readI64();
              struct.setNum_rowsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SORTING_COLUMNS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list43 = iprot.readListBegin();
                struct.sorting_columns = new java.util.ArrayList(_list43.size);
                @org.apache.thrift.annotation.Nullable SortingColumn _elem44;
                for (int _i45 = 0; _i45 < _list43.size; ++_i45)
                {
                  _elem44 = new SortingColumn();
                  _elem44.read(iprot);
                  struct.sorting_columns.add(_elem44);
                }
                iprot.readListEnd();
              }
              struct.setSorting_columnsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FILE_OFFSET
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.file_offset = iprot.readI64();
              struct.setFile_offsetIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TOTAL_COMPRESSED_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.total_compressed_size = iprot.readI64();
              struct.setTotal_compressed_sizeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // ORDINAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.ordinal = iprot.readI16();
              struct.setOrdinalIsSet(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
      if (!struct.isSetTotal_byte_size()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'total_byte_size' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetNum_rows()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'num_rows' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.columns != null) {
        oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
          for (ColumnChunk _iter46 : struct.columns)
          {
            _iter46.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TOTAL_BYTE_SIZE_FIELD_DESC);
      oprot.writeI64(struct.total_byte_size);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(NUM_ROWS_FIELD_DESC);
      oprot.writeI64(struct.num_rows);
      oprot.writeFieldEnd();
      if (struct.sorting_columns != null) {
        if (struct.isSetSorting_columns()) {
          oprot.writeFieldBegin(SORTING_COLUMNS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.sorting_columns.size()));
            for (SortingColumn _iter47 : struct.sorting_columns)
            {
              _iter47.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetFile_offset()) {
        oprot.writeFieldBegin(FILE_OFFSET_FIELD_DESC);
        oprot.writeI64(struct.file_offset);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTotal_compressed_size()) {
        oprot.writeFieldBegin(TOTAL_COMPRESSED_SIZE_FIELD_DESC);
        oprot.writeI64(struct.total_compressed_size);
        oprot.writeFieldEnd();
      }
      if (struct.isSetOrdinal()) {
        oprot.writeFieldBegin(ORDINAL_FIELD_DESC);
        oprot.writeI16(struct.ordinal);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class RowGroupTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, RowGroup struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.columns.size());
        for (ColumnChunk _iter48 : struct.columns)
        {
          _iter48.write(oprot);
        }
      }
      oprot.writeI64(struct.total_byte_size);
      oprot.writeI64(struct.num_rows);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetSorting_columns()) {
        optionals.set(0);
      }
      if (struct.isSetFile_offset()) {
        optionals.set(1);
      }
      if (struct.isSetTotal_compressed_size()) {
        optionals.set(2);
      }
      if (struct.isSetOrdinal()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetSorting_columns()) {
        {
          oprot.writeI32(struct.sorting_columns.size());
          for (SortingColumn _iter49 : struct.sorting_columns)
          {
            _iter49.write(oprot);
          }
        }
      }
      if (struct.isSetFile_offset()) {
        oprot.writeI64(struct.file_offset);
      }
      if (struct.isSetTotal_compressed_size()) {
        oprot.writeI64(struct.total_compressed_size);
      }
      if (struct.isSetOrdinal()) {
        oprot.writeI16(struct.ordinal);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, RowGroup struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TList _list50 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
        struct.columns = new java.util.ArrayList(_list50.size);
        @org.apache.thrift.annotation.Nullable ColumnChunk _elem51;
        for (int _i52 = 0; _i52 < _list50.size; ++_i52)
        {
          _elem51 = new ColumnChunk();
          _elem51.read(iprot);
          struct.columns.add(_elem51);
        }
      }
      struct.setColumnsIsSet(true);
      struct.total_byte_size = iprot.readI64();
      struct.setTotal_byte_sizeIsSet(true);
      struct.num_rows = iprot.readI64();
      struct.setNum_rowsIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.sorting_columns = new java.util.ArrayList(_list53.size);
          @org.apache.thrift.annotation.Nullable SortingColumn _elem54;
          for (int _i55 = 0; _i55 < _list53.size; ++_i55)
          {
            _elem54 = new SortingColumn();
            _elem54.read(iprot);
            struct.sorting_columns.add(_elem54);
          }
        }
        struct.setSorting_columnsIsSet(true);
      }
      if (incoming.get(1)) {
        struct.file_offset = iprot.readI64();
        struct.setFile_offsetIsSet(true);
      }
      if (incoming.get(2)) {
        struct.total_compressed_size = iprot.readI64();
        struct.setTotal_compressed_sizeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.ordinal = iprot.readI16();
        struct.setOrdinalIsSet(true);
      }
    }
  }

  private static  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();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy