@Test public void testUtils() { Assert.assertEquals(1, DataPack.packRowCount(65537, 1)); Assert.assertEquals(65536, DataPack.packRowCount(65536, 0)); }
public static int packRowCount(long rowCount, int packId) { int packCount = rowCountToPackCount(rowCount); assert packId >= 0 && packId < packCount; if (packId < packCount - 1) { return DataPack.MAX_COUNT; } else { int packRowCount = (int) (rowCount & MASK); return packRowCount == 0 ? DataPack.MAX_COUNT : packRowCount; } }
DataPack implements DPValues, Freeable { public static int packRowCount(long rowCount, int packId) { int packCount = rowCountToPackCount(rowCount); assert packId >= 0 && packId < packCount; if (packId < packCount - 1) { return DataPack.MAX_COUNT; } else { int packRowCount = (int) (rowCount & MASK); return packRowCount == 0 ? DataPack.MAX_COUNT : packRowCount; } } }
DataPack implements DPValues, Freeable { public static int packRowCount(long rowCount, int packId) { int packCount = rowCountToPackCount(rowCount); assert packId >= 0 && packId < packCount; if (packId < packCount - 1) { return DataPack.MAX_COUNT; } else { int packRowCount = (int) (rowCount & MASK); return packRowCount == 0 ? DataPack.MAX_COUNT : packRowCount; } } DataPack(ByteSlice data, ByteSlice cmpData, DataPackNode dpn); }
DataPack implements DPValues, Freeable { public static int packRowCount(long rowCount, int packId) { int packCount = rowCountToPackCount(rowCount); assert packId >= 0 && packId < packCount; if (packId < packCount - 1) { return DataPack.MAX_COUNT; } else { int packRowCount = (int) (rowCount & MASK); return packRowCount == 0 ? DataPack.MAX_COUNT : packRowCount; } } DataPack(ByteSlice data, ByteSlice cmpData, DataPackNode dpn); final int version(); final long dataAddr(); final ByteSlice data(); final ByteSlice cmpData(); final DictStruct dictStruct(byte dataType, DataPackNode dpn); @Override final int valueCount(); final int serializedSize(); @Override final void free(); final void write(ByteBufferWriter writer); final Object compress(byte dataType, boolean isIndexed, DataPackNode dpn); final void decompress(byte dataType, DataPackNode dpn); @Override long uniformValAt(int index, byte type); @Override int intValueAt(int index); @Override long longValueAt(int index); @Override float floatValueAt(int index); @Override double doubleValueAt(int index); @Override void foreach(int start, int count, IntSetter setter); int foreach(BitMap position, IntSetter setter); @Override void foreach(int start, int count, LongSetter setter); int foreach(BitMap position, LongSetter setter); @Override void foreach(int start, int count, FloatSetter setter); int foreach(BitMap position, FloatSetter setter); @Override void foreach(int start, int count, DoubleSetter setter); int foreach(BitMap position, DoubleSetter setter); final UTF8String stringValueAt(int index); final void rawValueAt(int index, BytePiece bytes); final byte[] rawValueAt(int index); final ByteBuffer valueAt(int index); @Override final void foreach(int start, int count, BytePieceSetter setter); @Override final void foreach(int start, int count, ByteArraySetter setter); int foreach(BitMap position, BytePieceSetter setter); static int rowCountToPackCount(long count); static int packIdByRowId(long rowId); static int rowInPackByRowId(long rowId); static int packRowCount(long rowCount, int packId); }
DataPack implements DPValues, Freeable { public static int packRowCount(long rowCount, int packId) { int packCount = rowCountToPackCount(rowCount); assert packId >= 0 && packId < packCount; if (packId < packCount - 1) { return DataPack.MAX_COUNT; } else { int packRowCount = (int) (rowCount & MASK); return packRowCount == 0 ? DataPack.MAX_COUNT : packRowCount; } } DataPack(ByteSlice data, ByteSlice cmpData, DataPackNode dpn); final int version(); final long dataAddr(); final ByteSlice data(); final ByteSlice cmpData(); final DictStruct dictStruct(byte dataType, DataPackNode dpn); @Override final int valueCount(); final int serializedSize(); @Override final void free(); final void write(ByteBufferWriter writer); final Object compress(byte dataType, boolean isIndexed, DataPackNode dpn); final void decompress(byte dataType, DataPackNode dpn); @Override long uniformValAt(int index, byte type); @Override int intValueAt(int index); @Override long longValueAt(int index); @Override float floatValueAt(int index); @Override double doubleValueAt(int index); @Override void foreach(int start, int count, IntSetter setter); int foreach(BitMap position, IntSetter setter); @Override void foreach(int start, int count, LongSetter setter); int foreach(BitMap position, LongSetter setter); @Override void foreach(int start, int count, FloatSetter setter); int foreach(BitMap position, FloatSetter setter); @Override void foreach(int start, int count, DoubleSetter setter); int foreach(BitMap position, DoubleSetter setter); final UTF8String stringValueAt(int index); final void rawValueAt(int index, BytePiece bytes); final byte[] rawValueAt(int index); final ByteBuffer valueAt(int index); @Override final void foreach(int start, int count, BytePieceSetter setter); @Override final void foreach(int start, int count, ByteArraySetter setter); int foreach(BitMap position, BytePieceSetter setter); static int rowCountToPackCount(long count); static int packIdByRowId(long rowId); static int rowInPackByRowId(long rowId); static int packRowCount(long rowCount, int packId); static final int SHIFT; static final int MASK; static final int MAX_COUNT; }