parquet.format.RowGroup Maven / Gradle / Ivy
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package parquet.format;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;
public class RowGroup implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("RowGroup");
private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.LIST, (short)1);
private static final TField TOTAL_BYTE_SIZE_FIELD_DESC = new TField("total_byte_size", TType.I64, (short)2);
private static final TField NUM_ROWS_FIELD_DESC = new TField("num_rows", TType.I64, (short)3);
private static final TField SORTING_COLUMNS_FIELD_DESC = new TField("sorting_columns", TType.LIST, (short)4);
public List columns;
/**
* Total byte size of all the uncompressed column data in this row group *
*/
public long total_byte_size;
/**
* Number of rows in this row group *
*/
public long 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.
*/
public List sorting_columns;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
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");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
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;
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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public 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 BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.REQUIRED,
new ListMetaData(TType.LIST,
new StructMetaData(TType.STRUCT, ColumnChunk.class))));
tmpMap.put(_Fields.TOTAL_BYTE_SIZE, new FieldMetaData("total_byte_size", TFieldRequirementType.REQUIRED,
new FieldValueMetaData(TType.I64)));
tmpMap.put(_Fields.NUM_ROWS, new FieldMetaData("num_rows", TFieldRequirementType.REQUIRED,
new FieldValueMetaData(TType.I64)));
tmpMap.put(_Fields.SORTING_COLUMNS, new FieldMetaData("sorting_columns", TFieldRequirementType.OPTIONAL,
new ListMetaData(TType.LIST,
new StructMetaData(TType.STRUCT, SortingColumn.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(RowGroup.class, metaDataMap);
}
public RowGroup() {
}
public RowGroup(
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_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetColumns()) {
List __this__columns = new ArrayList();
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()) {
List __this__sorting_columns = new ArrayList();
for (SortingColumn other_element : other.sorting_columns) {
__this__sorting_columns.add(new SortingColumn(other_element));
}
this.sorting_columns = __this__sorting_columns;
}
}
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;
}
public int getColumnsSize() {
return (this.columns == null) ? 0 : this.columns.size();
}
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 ArrayList();
}
this.columns.add(elem);
}
public List getColumns() {
return this.columns;
}
public RowGroup setColumns(List columns) {
this.columns = columns;
return this;
}
public void unsetColumns() {
this.columns = null;
}
/** Returns true if field columns is set (has been asigned 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_bit_vector.clear(__TOTAL_BYTE_SIZE_ISSET_ID);
}
/** Returns true if field total_byte_size is set (has been asigned a value) and false otherwise */
public boolean isSetTotal_byte_size() {
return __isset_bit_vector.get(__TOTAL_BYTE_SIZE_ISSET_ID);
}
public void setTotal_byte_sizeIsSet(boolean value) {
__isset_bit_vector.set(__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_bit_vector.clear(__NUM_ROWS_ISSET_ID);
}
/** Returns true if field num_rows is set (has been asigned a value) and false otherwise */
public boolean isSetNum_rows() {
return __isset_bit_vector.get(__NUM_ROWS_ISSET_ID);
}
public void setNum_rowsIsSet(boolean value) {
__isset_bit_vector.set(__NUM_ROWS_ISSET_ID, value);
}
public int getSorting_columnsSize() {
return (this.sorting_columns == null) ? 0 : this.sorting_columns.size();
}
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 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.
*/
public 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(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 asigned 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;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMNS:
if (value == null) {
unsetColumns();
} else {
setColumns((List)value);
}
break;
case TOTAL_BYTE_SIZE:
if (value == null) {
unsetTotal_byte_size();
} else {
setTotal_byte_size((Long)value);
}
break;
case NUM_ROWS:
if (value == null) {
unsetNum_rows();
} else {
setNum_rows((Long)value);
}
break;
case SORTING_COLUMNS:
if (value == null) {
unsetSorting_columns();
} else {
setSorting_columns((List)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMNS:
return getColumns();
case TOTAL_BYTE_SIZE:
return new Long(getTotal_byte_size());
case NUM_ROWS:
return new Long(getNum_rows());
case SORTING_COLUMNS:
return getSorting_columns();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new 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();
}
throw new IllegalStateException();
}
@Override
public boolean equals(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;
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;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_columns = true && (isSetColumns());
builder.append(present_columns);
if (present_columns)
builder.append(columns);
boolean present_total_byte_size = true;
builder.append(present_total_byte_size);
if (present_total_byte_size)
builder.append(total_byte_size);
boolean present_num_rows = true;
builder.append(present_num_rows);
if (present_num_rows)
builder.append(num_rows);
boolean present_sorting_columns = true && (isSetSorting_columns());
builder.append(present_sorting_columns);
if (present_sorting_columns)
builder.append(sorting_columns);
return builder.toHashCode();
}
public int compareTo(RowGroup other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RowGroup typedOther = (RowGroup)other;
lastComparison = Boolean.valueOf(isSetColumns()).compareTo(typedOther.isSetColumns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetColumns()) {
lastComparison = TBaseHelper.compareTo(this.columns, typedOther.columns);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTotal_byte_size()).compareTo(typedOther.isSetTotal_byte_size());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTotal_byte_size()) {
lastComparison = TBaseHelper.compareTo(this.total_byte_size, typedOther.total_byte_size);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNum_rows()).compareTo(typedOther.isSetNum_rows());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNum_rows()) {
lastComparison = TBaseHelper.compareTo(this.num_rows, typedOther.num_rows);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSorting_columns()).compareTo(typedOther.isSetSorting_columns());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSorting_columns()) {
lastComparison = TBaseHelper.compareTo(this.sorting_columns, typedOther.sorting_columns);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
switch (field.id) {
case 1: // COLUMNS
if (field.type == TType.LIST) {
{
TList _list12 = iprot.readListBegin();
this.columns = new ArrayList(_list12.size);
for (int _i13 = 0; _i13 < _list12.size; ++_i13)
{
ColumnChunk _elem14;
_elem14 = new ColumnChunk();
_elem14.read(iprot);
this.columns.add(_elem14);
}
iprot.readListEnd();
}
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // TOTAL_BYTE_SIZE
if (field.type == TType.I64) {
this.total_byte_size = iprot.readI64();
setTotal_byte_sizeIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // NUM_ROWS
if (field.type == TType.I64) {
this.num_rows = iprot.readI64();
setNum_rowsIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // SORTING_COLUMNS
if (field.type == TType.LIST) {
{
TList _list15 = iprot.readListBegin();
this.sorting_columns = new ArrayList(_list15.size);
for (int _i16 = 0; _i16 < _list15.size; ++_i16)
{
SortingColumn _elem17;
_elem17 = new SortingColumn();
_elem17.read(iprot);
this.sorting_columns.add(_elem17);
}
iprot.readListEnd();
}
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
if (!isSetTotal_byte_size()) {
throw new TProtocolException("Required field 'total_byte_size' was not found in serialized data! Struct: " + toString());
}
if (!isSetNum_rows()) {
throw new TProtocolException("Required field 'num_rows' was not found in serialized data! Struct: " + toString());
}
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.columns != null) {
oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
for (ColumnChunk _iter18 : this.columns)
{
_iter18.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(TOTAL_BYTE_SIZE_FIELD_DESC);
oprot.writeI64(this.total_byte_size);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_ROWS_FIELD_DESC);
oprot.writeI64(this.num_rows);
oprot.writeFieldEnd();
if (this.sorting_columns != null) {
if (isSetSorting_columns()) {
oprot.writeFieldBegin(SORTING_COLUMNS_FIELD_DESC);
{
oprot.writeListBegin(new TList(TType.STRUCT, this.sorting_columns.size()));
for (SortingColumn _iter19 : this.sorting_columns)
{
_iter19.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new 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;
}
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
if (columns == null) {
throw new 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.
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy