Class BinaryValues
The values of a BYTE_ARRAY, FIXED_LEN_BYTE_ARRAY or INT96 leaf in a ColumnReader's
batch, from ColumnReader.getBinaryValues(). Value i is the i-th leaf value, i in
[0, size()). A null value has length 0 (see ColumnReader.getLeafValidity()), and
getBinary(int) returns an empty array for it.
Value i occupies [start(i), end(i)) of buffer(i). A loop over a value's bytes reads that
range of the array:
BinaryValues values = column.getBinaryValues();
for (int i = 0; i < values.size(); i++) {
byte[] buffer = values.buffer(i);
for (int p = values.start(i); p < values.end(i); p++) {
consume(buffer[p]);
}
}
buffer(i) is an array value i can be read from. Do not write to it: the array of a
dictionary-encoded value holds the dictionary's entries, which every batch drawing on that
dictionary reads, so a write changes values of earlier and later batches as well. Values may
or may not share an array, within a batch or across batches, and nothing is promised about
which array a value is read from or about bytes outside its range.
This API is Experimental: it may change in future releases without prior
deprecation.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]buffer(int i) The array valueiis read from.booleancontentEquals(int i, byte[] other, int offset, int length) Whether valueiequals the bytes[offset, offset + length)ofother.voidcopyTo(int i, byte[] dst, int dstOffset) Copies valueiintodst, fromdstOffseton.intend(int i) Where valueiends inbuffer(int), exclusive.byte[]getBinary(int i) A copy of valuei.intlength(int i) The length of valueiin bytes.intsize()The number of values,ColumnReader.getValueCount().intstart(int i) Where valueistarts inbuffer(int), inclusive.
-
Method Details
-
size
public int size()The number of values,ColumnReader.getValueCount(). -
buffer
public byte[] buffer(int i) The array valueiis read from.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size())
-
start
public int start(int i) Where valueistarts inbuffer(int), inclusive.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size())
-
end
public int end(int i) Where valueiends inbuffer(int), exclusive.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size())
-
length
public int length(int i) The length of valueiin bytes.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size())
-
copyTo
public void copyTo(int i, byte[] dst, int dstOffset) Copies valueiintodst, fromdstOffseton.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size()), or the value does not fit indstfromdstOffseton
-
contentEquals
public boolean contentEquals(int i, byte[] other, int offset, int length) Whether valueiequals the bytes[offset, offset + length)ofother.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size()), or the range is not withinotherIllegalArgumentException- iflengthis negative
-
getBinary
public byte[] getBinary(int i) A copy of valuei.- Throws:
IndexOutOfBoundsException- ifiis not in[0, size())
-