/** * Right now it is set to default values. We may use this in future * set the compressor. * before 1.5.0, we set a enum 'compression_codec'; * after 1.5.0, we use string 'compressor_name' instead */ public static ChunkCompressionMeta getChunkCompressorMeta( ColumnPage inputPage, long encodedDataLength) throws IOException { ChunkCompressionMeta chunkCompressionMeta = new ChunkCompressionMeta(); // we will not use this field any longer and will use compressor_name instead, // but in thrift definition, this field is required so we cannot set it to null, otherwise // it will cause deserialization error in runtime (required field cannot be null). chunkCompressionMeta.setCompression_codec(CompressionCodec.DEPRECATED); chunkCompressionMeta.setCompressor_name(inputPage.getColumnCompressorName()); chunkCompressionMeta.setTotal_compressed_size(encodedDataLength); chunkCompressionMeta.setTotal_uncompressed_size(inputPage.getPageLengthInBytes()); return chunkCompressionMeta; }
public Object getFieldValue(_Fields field) { switch (field) { case COMPRESSION_CODEC: return getCompression_codec(); case TOTAL_UNCOMPRESSED_SIZE: return getTotal_uncompressed_size(); case TOTAL_COMPRESSED_SIZE: return getTotal_compressed_size(); case COMPRESSOR_NAME: return getCompressor_name(); } 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 COMPRESSION_CODEC: return isSetCompression_codec(); case TOTAL_UNCOMPRESSED_SIZE: return isSetTotal_uncompressed_size(); case TOTAL_COMPRESSED_SIZE: return isSetTotal_compressed_size(); case COMPRESSOR_NAME: return isSetCompressor_name(); } throw new IllegalStateException(); }
/** * Performs a deep copy on <i>other</i>. */ public ChunkCompressionMeta(ChunkCompressionMeta other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetCompression_codec()) { this.compression_codec = other.compression_codec; } this.total_uncompressed_size = other.total_uncompressed_size; this.total_compressed_size = other.total_compressed_size; if (other.isSetCompressor_name()) { this.compressor_name = other.compressor_name; } }
case COMPRESSION_CODEC: if (value == null) { unsetCompression_codec(); } else { setCompression_codec((CompressionCodec)value); unsetTotal_uncompressed_size(); } else { setTotal_uncompressed_size((Long)value); unsetTotal_compressed_size(); } else { setTotal_compressed_size((Long)value); unsetCompressor_name(); } else { setCompressor_name((String)value);
case 1: // CHUNK_META if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.chunk_meta = new ChunkCompressionMeta(); struct.chunk_meta.read(iprot); struct.setChunk_metaIsSet(true); } else {
/** * get the compressor name from chunk meta * before 1.5.0, we only support snappy and do not have compressor_name field; * after 1.5.0, we directly get the compressor from the compressor_name field */ public static String getCompressorNameFromChunkMeta(ChunkCompressionMeta chunkCompressionMeta) { if (chunkCompressionMeta.isSetCompressor_name()) { return chunkCompressionMeta.getCompressor_name(); } else { // this is for legacy store before 1.5.0 return CompressorFactory.NativeSupportedCompressor.SNAPPY.getName(); } } /**
public void write(org.apache.thrift.protocol.TProtocol oprot, ChunkCompressionMeta struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.compression_codec != null) { oprot.writeFieldBegin(COMPRESSION_CODEC_FIELD_DESC); oprot.writeI32(struct.compression_codec.getValue()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TOTAL_UNCOMPRESSED_SIZE_FIELD_DESC); oprot.writeI64(struct.total_uncompressed_size); oprot.writeFieldEnd(); oprot.writeFieldBegin(TOTAL_COMPRESSED_SIZE_FIELD_DESC); oprot.writeI64(struct.total_compressed_size); oprot.writeFieldEnd(); if (struct.compressor_name != null) { if (struct.isSetCompressor_name()) { oprot.writeFieldBegin(COMPRESSOR_NAME_FIELD_DESC); oprot.writeString(struct.compressor_name); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public ChunkCompressionMeta deepCopy() { return new ChunkCompressionMeta(this); }
sb.append(this.total_compressed_size); first = false; if (isSetCompressor_name()) { if (!first) sb.append(", "); sb.append("compressor_name:");
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof ChunkCompressionMeta) return this.equals((ChunkCompressionMeta)that); return false; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, DataChunk2 struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.chunk_meta = new ChunkCompressionMeta(); struct.chunk_meta.read(iprot); struct.setChunk_metaIsSet(true); struct.rowMajor = iprot.readBool();
return false; boolean this_present_compression_codec = true && this.isSetCompression_codec(); boolean that_present_compression_codec = true && that.isSetCompression_codec(); if (this_present_compression_codec || that_present_compression_codec) { if (!(this_present_compression_codec && that_present_compression_codec)) boolean this_present_compressor_name = true && this.isSetCompressor_name(); boolean that_present_compressor_name = true && that.isSetCompressor_name(); if (this_present_compressor_name || that_present_compressor_name) { if (!(this_present_compressor_name && that_present_compressor_name))
__isset_bitfield = other.__isset_bitfield; if (other.isSetChunk_meta()) { this.chunk_meta = new ChunkCompressionMeta(other.chunk_meta);
@Override public void write(org.apache.thrift.protocol.TProtocol prot, ChunkCompressionMeta struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.compression_codec.getValue()); oprot.writeI64(struct.total_uncompressed_size); oprot.writeI64(struct.total_compressed_size); BitSet optionals = new BitSet(); if (struct.isSetCompressor_name()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetCompressor_name()) { oprot.writeString(struct.compressor_name); } }
if (!(this_present_chunk_meta && that_present_chunk_meta)) return false; if (!this.chunk_meta.equals(that.chunk_meta)) return false;
lastComparison = Boolean.valueOf(isSetCompression_codec()).compareTo(other.isSetCompression_codec()); if (lastComparison != 0) { return lastComparison; if (isSetCompression_codec()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.compression_codec, other.compression_codec); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetTotal_uncompressed_size()).compareTo(other.isSetTotal_uncompressed_size()); if (lastComparison != 0) { return lastComparison; if (isSetTotal_uncompressed_size()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.total_uncompressed_size, other.total_uncompressed_size); if (lastComparison != 0) { lastComparison = 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) { lastComparison = Boolean.valueOf(isSetCompressor_name()).compareTo(other.isSetCompressor_name()); if (lastComparison != 0) { return lastComparison; if (isSetCompressor_name()) {
case 1: // CHUNK_META if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.chunk_meta = new ChunkCompressionMeta(); struct.chunk_meta.read(iprot); struct.setChunk_metaIsSet(true); } else {
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_compression_codec = true && (isSetCompression_codec()); list.add(present_compression_codec); if (present_compression_codec) list.add(compression_codec.getValue()); boolean present_total_uncompressed_size = true; list.add(present_total_uncompressed_size); if (present_total_uncompressed_size) list.add(total_uncompressed_size); boolean present_total_compressed_size = true; list.add(present_total_compressed_size); if (present_total_compressed_size) list.add(total_compressed_size); boolean present_compressor_name = true && (isSetCompressor_name()); list.add(present_compressor_name); if (present_compressor_name) list.add(compressor_name); return list.hashCode(); }
__isset_bitfield = other.__isset_bitfield; if (other.isSetChunk_meta()) { this.chunk_meta = new ChunkCompressionMeta(other.chunk_meta);