@Override public void serialize(ColumnValueSelector<?> selector) throws IOException { writer.add(selector.getLong()); }
@Override public void open() throws IOException { writer = CompressionFactory.getLongSerializer( segmentWriteOutMedium, StringUtils.format("%s.long_column", filenameBase), byteOrder, encoding, compression ); writer.open(); }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { SerializerUtils.writeInt(channel, Ints.checkedCast(writer.getSerializedSize())); writer.writeTo(channel, smoosher); if (!nullRowsBitmap.isEmpty()) { nullValueBitmapWriter.writeTo(channel, smoosher); } } }
public void testValues(long[] values) throws Exception { ColumnarLongsSerializer serializer = CompressionFactory.getLongSerializer( new OffHeapMemorySegmentWriteOutMedium(), "test", order, encodingStrategy, compressionStrategy ); serializer.open(); for (long value : values) { serializer.add(value); } Assert.assertEquals(values.length, serializer.size()); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.writeTo(Channels.newChannel(baos), null); Assert.assertEquals(baos.size(), serializer.getSerializedSize()); CompressedColumnarLongsSupplier supplier = CompressedColumnarLongsSupplier.fromByteBuffer(ByteBuffer.wrap(baos.toByteArray()), order); ColumnarLongs longs = supplier.get(); assertIndexMatchesVals(longs, values); longs.close(); }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { writer.writeTo(channel, smoosher); } }
@Override public long getSerializedSize() throws IOException { return writer.getSerializedSize(); }
compressionStrategy ); serializer.open(); serializer.add(value); Assert.assertEquals(values.length, serializer.size()); serializer.writeTo(Channels.newChannel(baos), null); Assert.assertEquals(baos.size(), serializer.getSerializedSize()); CompressedColumnarLongsSupplier supplier = CompressedColumnarLongsSupplier .fromByteBuffer(ByteBuffer.wrap(baos.toByteArray()), order);
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { makeDelegate(); delegate.writeTo(channel, smoosher); } }
@Override public long getSerializedSize() throws IOException { makeDelegate(); return delegate.getSerializedSize(); }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { SerializerUtils.writeInt(channel, Ints.checkedCast(writer.getSerializedSize())); writer.writeTo(channel, smoosher); if (!nullRowsBitmap.isEmpty()) { nullValueBitmapWriter.writeTo(channel, smoosher); } } }
@Override public void open() throws IOException { writer = CompressionFactory.getLongSerializer( segmentWriteOutMedium, StringUtils.format("%s.long_column", filenameBase), byteOrder, encoding, compression ); writer.open(); nullValueBitmapWriter = new ByteBufferWriter<>( segmentWriteOutMedium, bitmapSerdeFactory.getObjectStrategy() ); nullValueBitmapWriter.open(); nullRowsBitmap = bitmapSerdeFactory.getBitmapFactory().makeEmptyMutableBitmap(); }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { writer.writeTo(channel, smoosher); } }
@Override public long getSerializedSize() throws IOException { nullValueBitmapWriter.write(bitmapSerdeFactory.getBitmapFactory().makeImmutableBitmap(nullRowsBitmap)); long bitmapSize = nullRowsBitmap.isEmpty() ? 0L : nullValueBitmapWriter.getSerializedSize(); return Integer.BYTES + writer.getSerializedSize() + bitmapSize; }
@Override public void open() throws IOException { writer = CompressionFactory.getLongSerializer( segmentWriteOutMedium, StringUtils.format("%s.long_column", filenameBase), byteOrder, encoding, compression ); writer.open(); }
@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { makeDelegate(); delegate.writeTo(channel, smoosher); } }
@Override public void serialize(ColumnValueSelector<?> selector) throws IOException { writer.add(selector.getLong()); }