/** * Sets the vector element to true if the bit is set. */ public int getSetBits(int batchSize, boolean[] vector) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { vector[i] = nextBit(); count += vector[i] ? 1 : 0; } return count; }
/** * Return the number of unset bits */ public int getUnsetBits(int batchSize) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { count += nextBit() ? 0 : 1; } return count; }
/** * Sets the vector element to true for the batchSize number of elements starting at offset * if the bit is not set. */ public int getUnsetBits(int batchSize, boolean[] vector, int offset) throws IOException { int count = 0; for (int i = offset; i < batchSize + offset; i++) { vector[i] = !nextBit(); count += vector[i] ? 1 : 0; } return count; }
/** * Sets the vector element to true if the bit is set, skipping the null values. */ public int getSetBits(int batchSize, boolean[] vector, boolean[] isNull) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { if (!isNull[i]) { vector[i] = nextBit(); count += vector[i] ? 1 : 0; } } return count; }
/** * Sets the vector element to true if the bit is set. */ public void getSetBits(Type type, int batchSize, BlockBuilder builder) throws IOException { for (int i = 0; i < batchSize; i++) { type.writeBoolean(builder, nextBit()); } }
@Override protected Boolean readValue(BooleanInputStream valueStream) throws IOException { return valueStream.nextBit(); } }
public int countBitsSet(int items) throws IOException { int count = 0; // count buffered data if (items > bitsInData && bitsInData > 0) { count += bitCount(data); items -= bitsInData; bitsInData = 0; } // count whole bytes while (items > 8) { count += bitCount(byteStream.next()); items -= 8; } // count remaining bits for (int i = 0; i < items; i++) { count += nextBit() ? 1 : 0; } return count; }
for (int i = 0; i < nextBatchSize; i++) { long id = dataStream.next(); if (inDictionaryStream.nextBit()) { type.writeLong(builder, dictionary[(int) id]); if (!presentStream.nextBit()) { builder.appendNull(); if (inDictionaryStream == null || inDictionaryStream.nextBit()) { type.writeLong(builder, dictionary[(int) id]);
if (presentStream.nextBit()) { verify(dataStream != null); type.writeLong(builder, floatToRawIntBits(dataStream.next()));
if (presentStream.nextBit()) { verify(dataStream != null); type.writeLong(builder, dataStream.next());
if (presentStream.nextBit()) { verify(dataStream != null); type.writeDouble(builder, dataStream.next());
if (presentStream.nextBit()) { verify(dataStream != null); type.writeLong(builder, dataStream.next());
if (presentStream.nextBit()) { verify(secondsStream != null, "Value is not null but seconds stream is not present"); verify(nanosStream != null, "Value is not null but nanos stream is not present");
if (presentStream.nextBit()) {
/** * Return the number of unset bits */ public int getUnsetBits(int batchSize) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { count += nextBit() ? 0 : 1; } return count; }
/** * Sets the vector element to true if the bit is set. */ public int getSetBits(int batchSize, boolean[] vector) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { vector[i] = nextBit(); count += vector[i] ? 1 : 0; } return count; }
@Override protected Boolean readValue(BooleanInputStream valueStream) throws IOException { return valueStream.nextBit(); } }
/** * Sets the vector element to true if the bit is set. */ public void getSetBits(Type type, int batchSize, BlockBuilder builder) throws IOException { for (int i = 0; i < batchSize; i++) { type.writeBoolean(builder, nextBit()); } }