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

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

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

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 javax.annotation.Generated;
import com.facebook.presto.hive.$internal.org.slf4j.Logger;
import com.facebook.presto.hive.$internal.org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
/**
 * Statistics per row group and per page
 * All fields are optional.
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-10-17")
public class Statistics 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("Statistics");

  private static final org.apache.thrift.protocol.TField MAX_FIELD_DESC = new org.apache.thrift.protocol.TField("max", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField MIN_FIELD_DESC = new org.apache.thrift.protocol.TField("min", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField NULL_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("null_count", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField DISTINCT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("distinct_count", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField MAX_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("max_value", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField MIN_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("min_value", org.apache.thrift.protocol.TType.STRING, (short)6);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new StatisticsStandardSchemeFactory());
    schemes.put(TupleScheme.class, new StatisticsTupleSchemeFactory());
  }

  /**
   * DEPRECATED: min and max value of the column. Use min_value and max_value.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   * 
   * These fields encode min and max values determined by signed comparison
   * only. New files should use the correct order for a column's logical type
   * and store the values in the min_value and max_value fields.
   * 
   * To support older readers, these may be set when the column order is
   * signed.
   */
  public ByteBuffer max; // optional
  public ByteBuffer min; // optional
  /**
   * count of null value in the column
   */
  public long null_count; // optional
  /**
   * count of distinct values occurring
   */
  public long distinct_count; // optional
  /**
   * Min and max values for the column, determined by its ColumnOrder.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   */
  public ByteBuffer max_value; // optional
  public ByteBuffer min_value; // 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 {
    /**
     * DEPRECATED: min and max value of the column. Use min_value and max_value.
     * 
     * Values are encoded using PLAIN encoding, except that variable-length byte
     * arrays do not include a length prefix.
     * 
     * These fields encode min and max values determined by signed comparison
     * only. New files should use the correct order for a column's logical type
     * and store the values in the min_value and max_value fields.
     * 
     * To support older readers, these may be set when the column order is
     * signed.
     */
    MAX((short)1, "max"),
    MIN((short)2, "min"),
    /**
     * count of null value in the column
     */
    NULL_COUNT((short)3, "null_count"),
    /**
     * count of distinct values occurring
     */
    DISTINCT_COUNT((short)4, "distinct_count"),
    /**
     * Min and max values for the column, determined by its ColumnOrder.
     * 
     * Values are encoded using PLAIN encoding, except that variable-length byte
     * arrays do not include a length prefix.
     */
    MAX_VALUE((short)5, "max_value"),
    MIN_VALUE((short)6, "min_value");

    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: // MAX
          return MAX;
        case 2: // MIN
          return MIN;
        case 3: // NULL_COUNT
          return NULL_COUNT;
        case 4: // DISTINCT_COUNT
          return DISTINCT_COUNT;
        case 5: // MAX_VALUE
          return MAX_VALUE;
        case 6: // MIN_VALUE
          return MIN_VALUE;
        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 __NULL_COUNT_ISSET_ID = 0;
  private static final int __DISTINCT_COUNT_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.MAX,_Fields.MIN,_Fields.NULL_COUNT,_Fields.DISTINCT_COUNT,_Fields.MAX_VALUE,_Fields.MIN_VALUE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.MAX, new org.apache.thrift.meta_data.FieldMetaData("max", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.MIN, new org.apache.thrift.meta_data.FieldMetaData("min", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.NULL_COUNT, new org.apache.thrift.meta_data.FieldMetaData("null_count", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DISTINCT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("distinct_count", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX_VALUE, new org.apache.thrift.meta_data.FieldMetaData("max_value", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.MIN_VALUE, new org.apache.thrift.meta_data.FieldMetaData("min_value", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Statistics.class, metaDataMap);
  }

  public Statistics() {
  }

  /**
   * Performs a deep copy on other.
   */
  public Statistics(Statistics other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetMax()) {
      this.max = org.apache.thrift.TBaseHelper.copyBinary(other.max);
    }
    if (other.isSetMin()) {
      this.min = org.apache.thrift.TBaseHelper.copyBinary(other.min);
    }
    this.null_count = other.null_count;
    this.distinct_count = other.distinct_count;
    if (other.isSetMax_value()) {
      this.max_value = org.apache.thrift.TBaseHelper.copyBinary(other.max_value);
    }
    if (other.isSetMin_value()) {
      this.min_value = org.apache.thrift.TBaseHelper.copyBinary(other.min_value);
    }
  }

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

  @Override
  public void clear() {
    this.max = null;
    this.min = null;
    setNull_countIsSet(false);
    this.null_count = 0;
    setDistinct_countIsSet(false);
    this.distinct_count = 0;
    this.max_value = null;
    this.min_value = null;
  }

  /**
   * DEPRECATED: min and max value of the column. Use min_value and max_value.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   * 
   * These fields encode min and max values determined by signed comparison
   * only. New files should use the correct order for a column's logical type
   * and store the values in the min_value and max_value fields.
   * 
   * To support older readers, these may be set when the column order is
   * signed.
   */
  public byte[] getMax() {
    setMax(org.apache.thrift.TBaseHelper.rightSize(max));
    return max == null ? null : max.array();
  }

  public ByteBuffer bufferForMax() {
    return org.apache.thrift.TBaseHelper.copyBinary(max);
  }

  /**
   * DEPRECATED: min and max value of the column. Use min_value and max_value.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   * 
   * These fields encode min and max values determined by signed comparison
   * only. New files should use the correct order for a column's logical type
   * and store the values in the min_value and max_value fields.
   * 
   * To support older readers, these may be set when the column order is
   * signed.
   */
  public Statistics setMax(byte[] max) {
    this.max = max == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(max, max.length));
    return this;
  }

  public Statistics setMax(ByteBuffer max) {
    this.max = org.apache.thrift.TBaseHelper.copyBinary(max);
    return this;
  }

  public void unsetMax() {
    this.max = null;
  }

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

  public void setMaxIsSet(boolean value) {
    if (!value) {
      this.max = null;
    }
  }

  public byte[] getMin() {
    setMin(org.apache.thrift.TBaseHelper.rightSize(min));
    return min == null ? null : min.array();
  }

  public ByteBuffer bufferForMin() {
    return org.apache.thrift.TBaseHelper.copyBinary(min);
  }

  public Statistics setMin(byte[] min) {
    this.min = min == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(min, min.length));
    return this;
  }

  public Statistics setMin(ByteBuffer min) {
    this.min = org.apache.thrift.TBaseHelper.copyBinary(min);
    return this;
  }

  public void unsetMin() {
    this.min = null;
  }

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

  public void setMinIsSet(boolean value) {
    if (!value) {
      this.min = null;
    }
  }

  /**
   * count of null value in the column
   */
  public long getNull_count() {
    return this.null_count;
  }

  /**
   * count of null value in the column
   */
  public Statistics setNull_count(long null_count) {
    this.null_count = null_count;
    setNull_countIsSet(true);
    return this;
  }

  public void unsetNull_count() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NULL_COUNT_ISSET_ID);
  }

  /** Returns true if field null_count is set (has been assigned a value) and false otherwise */
  public boolean isSetNull_count() {
    return EncodingUtils.testBit(__isset_bitfield, __NULL_COUNT_ISSET_ID);
  }

  public void setNull_countIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NULL_COUNT_ISSET_ID, value);
  }

  /**
   * count of distinct values occurring
   */
  public long getDistinct_count() {
    return this.distinct_count;
  }

  /**
   * count of distinct values occurring
   */
  public Statistics setDistinct_count(long distinct_count) {
    this.distinct_count = distinct_count;
    setDistinct_countIsSet(true);
    return this;
  }

  public void unsetDistinct_count() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DISTINCT_COUNT_ISSET_ID);
  }

  /** Returns true if field distinct_count is set (has been assigned a value) and false otherwise */
  public boolean isSetDistinct_count() {
    return EncodingUtils.testBit(__isset_bitfield, __DISTINCT_COUNT_ISSET_ID);
  }

  public void setDistinct_countIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DISTINCT_COUNT_ISSET_ID, value);
  }

  /**
   * Min and max values for the column, determined by its ColumnOrder.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   */
  public byte[] getMax_value() {
    setMax_value(org.apache.thrift.TBaseHelper.rightSize(max_value));
    return max_value == null ? null : max_value.array();
  }

  public ByteBuffer bufferForMax_value() {
    return org.apache.thrift.TBaseHelper.copyBinary(max_value);
  }

  /**
   * Min and max values for the column, determined by its ColumnOrder.
   * 
   * Values are encoded using PLAIN encoding, except that variable-length byte
   * arrays do not include a length prefix.
   */
  public Statistics setMax_value(byte[] max_value) {
    this.max_value = max_value == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(max_value, max_value.length));
    return this;
  }

  public Statistics setMax_value(ByteBuffer max_value) {
    this.max_value = org.apache.thrift.TBaseHelper.copyBinary(max_value);
    return this;
  }

  public void unsetMax_value() {
    this.max_value = null;
  }

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

  public void setMax_valueIsSet(boolean value) {
    if (!value) {
      this.max_value = null;
    }
  }

  public byte[] getMin_value() {
    setMin_value(org.apache.thrift.TBaseHelper.rightSize(min_value));
    return min_value == null ? null : min_value.array();
  }

  public ByteBuffer bufferForMin_value() {
    return org.apache.thrift.TBaseHelper.copyBinary(min_value);
  }

  public Statistics setMin_value(byte[] min_value) {
    this.min_value = min_value == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(min_value, min_value.length));
    return this;
  }

  public Statistics setMin_value(ByteBuffer min_value) {
    this.min_value = org.apache.thrift.TBaseHelper.copyBinary(min_value);
    return this;
  }

  public void unsetMin_value() {
    this.min_value = null;
  }

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

  public void setMin_valueIsSet(boolean value) {
    if (!value) {
      this.min_value = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case MAX:
      if (value == null) {
        unsetMax();
      } else {
        setMax((ByteBuffer)value);
      }
      break;

    case MIN:
      if (value == null) {
        unsetMin();
      } else {
        setMin((ByteBuffer)value);
      }
      break;

    case NULL_COUNT:
      if (value == null) {
        unsetNull_count();
      } else {
        setNull_count((Long)value);
      }
      break;

    case DISTINCT_COUNT:
      if (value == null) {
        unsetDistinct_count();
      } else {
        setDistinct_count((Long)value);
      }
      break;

    case MAX_VALUE:
      if (value == null) {
        unsetMax_value();
      } else {
        setMax_value((ByteBuffer)value);
      }
      break;

    case MIN_VALUE:
      if (value == null) {
        unsetMin_value();
      } else {
        setMin_value((ByteBuffer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case MAX:
      return getMax();

    case MIN:
      return getMin();

    case NULL_COUNT:
      return getNull_count();

    case DISTINCT_COUNT:
      return getDistinct_count();

    case MAX_VALUE:
      return getMax_value();

    case MIN_VALUE:
      return getMin_value();

    }
    throw new 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 IllegalArgumentException();
    }

    switch (field) {
    case MAX:
      return isSetMax();
    case MIN:
      return isSetMin();
    case NULL_COUNT:
      return isSetNull_count();
    case DISTINCT_COUNT:
      return isSetDistinct_count();
    case MAX_VALUE:
      return isSetMax_value();
    case MIN_VALUE:
      return isSetMin_value();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(Statistics that) {
    if (that == null)
      return false;

    boolean this_present_max = true && this.isSetMax();
    boolean that_present_max = true && that.isSetMax();
    if (this_present_max || that_present_max) {
      if (!(this_present_max && that_present_max))
        return false;
      if (!this.max.equals(that.max))
        return false;
    }

    boolean this_present_min = true && this.isSetMin();
    boolean that_present_min = true && that.isSetMin();
    if (this_present_min || that_present_min) {
      if (!(this_present_min && that_present_min))
        return false;
      if (!this.min.equals(that.min))
        return false;
    }

    boolean this_present_null_count = true && this.isSetNull_count();
    boolean that_present_null_count = true && that.isSetNull_count();
    if (this_present_null_count || that_present_null_count) {
      if (!(this_present_null_count && that_present_null_count))
        return false;
      if (this.null_count != that.null_count)
        return false;
    }

    boolean this_present_distinct_count = true && this.isSetDistinct_count();
    boolean that_present_distinct_count = true && that.isSetDistinct_count();
    if (this_present_distinct_count || that_present_distinct_count) {
      if (!(this_present_distinct_count && that_present_distinct_count))
        return false;
      if (this.distinct_count != that.distinct_count)
        return false;
    }

    boolean this_present_max_value = true && this.isSetMax_value();
    boolean that_present_max_value = true && that.isSetMax_value();
    if (this_present_max_value || that_present_max_value) {
      if (!(this_present_max_value && that_present_max_value))
        return false;
      if (!this.max_value.equals(that.max_value))
        return false;
    }

    boolean this_present_min_value = true && this.isSetMin_value();
    boolean that_present_min_value = true && that.isSetMin_value();
    if (this_present_min_value || that_present_min_value) {
      if (!(this_present_min_value && that_present_min_value))
        return false;
      if (!this.min_value.equals(that.min_value))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_max = true && (isSetMax());
    list.add(present_max);
    if (present_max)
      list.add(max);

    boolean present_min = true && (isSetMin());
    list.add(present_min);
    if (present_min)
      list.add(min);

    boolean present_null_count = true && (isSetNull_count());
    list.add(present_null_count);
    if (present_null_count)
      list.add(null_count);

    boolean present_distinct_count = true && (isSetDistinct_count());
    list.add(present_distinct_count);
    if (present_distinct_count)
      list.add(distinct_count);

    boolean present_max_value = true && (isSetMax_value());
    list.add(present_max_value);
    if (present_max_value)
      list.add(max_value);

    boolean present_min_value = true && (isSetMin_value());
    list.add(present_min_value);
    if (present_min_value)
      list.add(min_value);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetMax()).compareTo(other.isSetMax());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMax()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max, other.max);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMin()).compareTo(other.isSetMin());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMin()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.min, other.min);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNull_count()).compareTo(other.isSetNull_count());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNull_count()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_count, other.null_count);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDistinct_count()).compareTo(other.isSetDistinct_count());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDistinct_count()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.distinct_count, other.distinct_count);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMax_value()).compareTo(other.isSetMax_value());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMax_value()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max_value, other.max_value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMin_value()).compareTo(other.isSetMin_value());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMin_value()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.min_value, other.min_value);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("Statistics(");
    boolean first = true;

    if (isSetMax()) {
      sb.append("max:");
      if (this.max == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.max, sb);
      }
      first = false;
    }
    if (isSetMin()) {
      if (!first) sb.append(", ");
      sb.append("min:");
      if (this.min == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.min, sb);
      }
      first = false;
    }
    if (isSetNull_count()) {
      if (!first) sb.append(", ");
      sb.append("null_count:");
      sb.append(this.null_count);
      first = false;
    }
    if (isSetDistinct_count()) {
      if (!first) sb.append(", ");
      sb.append("distinct_count:");
      sb.append(this.distinct_count);
      first = false;
    }
    if (isSetMax_value()) {
      if (!first) sb.append(", ");
      sb.append("max_value:");
      if (this.max_value == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.max_value, sb);
      }
      first = false;
    }
    if (isSetMin_value()) {
      if (!first) sb.append(", ");
      sb.append("min_value:");
      if (this.min_value == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.min_value, sb);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

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

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, 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 StatisticsStandardSchemeFactory implements SchemeFactory {
    public StatisticsStandardScheme getScheme() {
      return new StatisticsStandardScheme();
    }
  }

  private static class StatisticsStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Statistics 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: // MAX
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.max = iprot.readBinary();
              struct.setMaxIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MIN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.min = iprot.readBinary();
              struct.setMinIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // NULL_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.null_count = iprot.readI64();
              struct.setNull_countIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // DISTINCT_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.distinct_count = iprot.readI64();
              struct.setDistinct_countIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // MAX_VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.max_value = iprot.readBinary();
              struct.setMax_valueIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // MIN_VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.min_value = iprot.readBinary();
              struct.setMin_valueIsSet(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, Statistics struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.max != null) {
        if (struct.isSetMax()) {
          oprot.writeFieldBegin(MAX_FIELD_DESC);
          oprot.writeBinary(struct.max);
          oprot.writeFieldEnd();
        }
      }
      if (struct.min != null) {
        if (struct.isSetMin()) {
          oprot.writeFieldBegin(MIN_FIELD_DESC);
          oprot.writeBinary(struct.min);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetNull_count()) {
        oprot.writeFieldBegin(NULL_COUNT_FIELD_DESC);
        oprot.writeI64(struct.null_count);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDistinct_count()) {
        oprot.writeFieldBegin(DISTINCT_COUNT_FIELD_DESC);
        oprot.writeI64(struct.distinct_count);
        oprot.writeFieldEnd();
      }
      if (struct.max_value != null) {
        if (struct.isSetMax_value()) {
          oprot.writeFieldBegin(MAX_VALUE_FIELD_DESC);
          oprot.writeBinary(struct.max_value);
          oprot.writeFieldEnd();
        }
      }
      if (struct.min_value != null) {
        if (struct.isSetMin_value()) {
          oprot.writeFieldBegin(MIN_VALUE_FIELD_DESC);
          oprot.writeBinary(struct.min_value);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class StatisticsTupleSchemeFactory implements SchemeFactory {
    public StatisticsTupleScheme getScheme() {
      return new StatisticsTupleScheme();
    }
  }

  private static class StatisticsTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Statistics struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetMax()) {
        optionals.set(0);
      }
      if (struct.isSetMin()) {
        optionals.set(1);
      }
      if (struct.isSetNull_count()) {
        optionals.set(2);
      }
      if (struct.isSetDistinct_count()) {
        optionals.set(3);
      }
      if (struct.isSetMax_value()) {
        optionals.set(4);
      }
      if (struct.isSetMin_value()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetMax()) {
        oprot.writeBinary(struct.max);
      }
      if (struct.isSetMin()) {
        oprot.writeBinary(struct.min);
      }
      if (struct.isSetNull_count()) {
        oprot.writeI64(struct.null_count);
      }
      if (struct.isSetDistinct_count()) {
        oprot.writeI64(struct.distinct_count);
      }
      if (struct.isSetMax_value()) {
        oprot.writeBinary(struct.max_value);
      }
      if (struct.isSetMin_value()) {
        oprot.writeBinary(struct.min_value);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Statistics struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.max = iprot.readBinary();
        struct.setMaxIsSet(true);
      }
      if (incoming.get(1)) {
        struct.min = iprot.readBinary();
        struct.setMinIsSet(true);
      }
      if (incoming.get(2)) {
        struct.null_count = iprot.readI64();
        struct.setNull_countIsSet(true);
      }
      if (incoming.get(3)) {
        struct.distinct_count = iprot.readI64();
        struct.setDistinct_countIsSet(true);
      }
      if (incoming.get(4)) {
        struct.max_value = iprot.readBinary();
        struct.setMax_valueIsSet(true);
      }
      if (incoming.get(5)) {
        struct.min_value = iprot.readBinary();
        struct.setMin_valueIsSet(true);
      }
    }
  }

}