@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { Channels.writeFully(channel, ByteBuffer.wrap(new byte[]{version.asByte()})); if (version.compareTo(VERSION.COMPRESSED) >= 0) { channel.write(ByteBuffer.wrap(Ints.toByteArray(flags))); } if (dictionaryWriter != null) { dictionaryWriter.writeTo(channel, smoosher); } if (valueWriter != null) { valueWriter.writeTo(channel, smoosher); } if (bitmapIndexWriter != null) { bitmapIndexWriter.writeTo(channel, smoosher); } if (spatialIndexWriter != null) { spatialIndexWriter.writeTo(channel, smoosher); } } }
public static VERSION fromByte(byte b) { final VERSION[] values = VERSION.values(); Preconditions.checkArgument(b < values.length, "Unsupported dictionary column version[%s]", b); return values[b]; }
@Override public void read(ByteBuffer buffer, ColumnBuilder builder, ColumnConfig columnConfig) final VERSION rVersion = VERSION.fromByte(buffer.get()); final int rFlags; if (rVersion.compareTo(VERSION.COMPRESSED) >= 0) { rFlags = buffer.getInt(); } else { rFlags = rVersion.equals(VERSION.UNCOMPRESSED_MULTI_VALUE) ? Feature.MULTI_VALUE.getMask() : NO_FLAGS;
public DictionaryEncodedColumnPartSerde build() if (mustWriteFlags(flags) && version.compareTo(VERSION.COMPRESSED) < 0) {
@Override public long getSerializedSize() throws IOException { long size = 1 + // version (version.compareTo(VERSION.COMPRESSED) >= 0 ? Integer.BYTES : 0); // flag if version >= compressed if (dictionaryWriter != null) { size += dictionaryWriter.getSerializedSize(); } if (valueWriter != null) { size += valueWriter.getSerializedSize(); } if (bitmapIndexWriter != null) { size += bitmapIndexWriter.getSerializedSize(); } if (spatialIndexWriter != null) { size += spatialIndexWriter.getSerializedSize(); } return size; }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { Channels.writeFully(channel, ByteBuffer.wrap(new byte[]{version.asByte()})); if (version.compareTo(VERSION.COMPRESSED) >= 0) { channel.write(ByteBuffer.wrap(Ints.toByteArray(flags))); } if (dictionaryWriter != null) { dictionaryWriter.writeTo(channel, smoosher); } if (valueWriter != null) { valueWriter.writeTo(channel, smoosher); } if (bitmapIndexWriter != null) { bitmapIndexWriter.writeTo(channel, smoosher); } if (spatialIndexWriter != null) { spatialIndexWriter.writeTo(channel, smoosher); } } }
public byte asByte() { return (byte) this.ordinal(); } }
public static VERSION fromByte(byte b) { final VERSION[] values = VERSION.values(); Preconditions.checkArgument(b < values.length, "Unsupported dictionary column version[%s]", b); return values[b]; }
public DictionaryEncodedColumnPartSerde build() if (mustWriteFlags(flags) && version.compareTo(VERSION.COMPRESSED) < 0) {
@Override public void read(ByteBuffer buffer, ColumnBuilder builder, ColumnConfig columnConfig) final VERSION rVersion = VERSION.fromByte(buffer.get()); final int rFlags; if (rVersion.compareTo(VERSION.COMPRESSED) >= 0) { rFlags = buffer.getInt(); } else { rFlags = rVersion.equals(VERSION.UNCOMPRESSED_MULTI_VALUE) ? Feature.MULTI_VALUE.getMask() : NO_FLAGS;
@Override public long getSerializedSize() throws IOException { long size = 1 + // version (version.compareTo(VERSION.COMPRESSED) >= 0 ? Integer.BYTES : 0); // flag if version >= compressed if (dictionaryWriter != null) { size += dictionaryWriter.getSerializedSize(); } if (valueWriter != null) { size += valueWriter.getSerializedSize(); } if (bitmapIndexWriter != null) { size += bitmapIndexWriter.getSerializedSize(); } if (spatialIndexWriter != null) { size += spatialIndexWriter.getSerializedSize(); } return size; }
public byte asByte() { return (byte) this.ordinal(); } }