Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void readBinary(int total, WritableBytesVector c, int rowId) {
ByteBufferOutputWriter outputWriter = ByteBufferOutputWriter::writeArrayByteBuffer;
int length;
for (int i = 0; i < total; i++) {
length = lengthsVector.getInt(rowId + i);
length = lengthsVector.getInt(currentRow + i);
try {
buffer = in.slice(length);
} catch (EOFException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ public void testSerialization() throws Exception {
readAndValidate(reader, writer.getBytes().toInputStream(), values.length, values);
}

@Test
public void testReadOnePageAcrossVectorBatches() throws Exception {
String[] values = {"a", "bbbb", "ccccc"};
writeData(writer, values);
reader.initFromPage(values.length, writer.getBytes().toInputStream());
HeapBytesVector vector = new HeapBytesVector(values.length);

reader.readBinary(1, vector, 0);
assertArrayEquals(values[0].getBytes(), vector.getBytes(0).getBytes());

vector.reset();
reader.readBinary(2, vector, 0);
assertArrayEquals(values[1].getBytes(), vector.getBytes(0).getBytes());
assertArrayEquals(values[2].getBytes(), vector.getBytes(1).getBytes());
}

@Test
public void testRandomStrings() throws Exception {
String[] values = Utils.getRandomStringSamples(1000, 32);
Expand Down
Loading