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 @@ -301,11 +301,13 @@ public void convertVector(ColumnVector fromColVector,
resultColVector.reset();
if (fromColVector.isRepeating) {
resultColVector.isRepeating = true;
if (fromColVector.noNulls || !fromColVector.isNull[0]) {
setConvertVectorElement(0);
} else {
resultColVector.noNulls = false;
resultColVector.isNull[0] = true;
if (batchSize > 0) {
if (fromColVector.noNulls || !fromColVector.isNull[0]) {
setConvertVectorElement(0);
} else {
resultColVector.noNulls = false;
resultColVector.isNull[0] = true;
}
}
} else if (fromColVector.noNulls) {
for (int i = 0; i < batchSize; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,4 +746,38 @@ private void testDecimalConvertToDecimalInNullStripe() throws Exception {
readDecimalInNullStripe("decimal(18,2)", DecimalColumnVector.class,
new String[]{"null", "1024", "1"});
}

@Test
public void testIntArrayToStringArrayFirstBatchAllEmpty() throws Exception {
TypeDescription fileSchema = TypeDescription.fromString("struct<col1:array<int>>");
TypeDescription readerSchema = TypeDescription.fromString("struct<col1:array<string>>");

try (Writer w = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf).setSchema(fileSchema))) {
VectorizedRowBatch b = fileSchema.createRowBatch(3);
ListColumnVector lc = (ListColumnVector) b.cols[0];
for (int i = 0; i < 3; i++) {
lc.offsets[i] = 0;
lc.lengths[i] = 0;
}
lc.childCount = 0;
b.size = 3;
w.addRowBatch(b);
}

try (Reader reader = OrcFile.createReader(testFilePath, OrcFile.readerOptions(conf));
RecordReader rows = reader.rows(reader.options().schema(readerSchema))) {
VectorizedRowBatch rb = readerSchema.createRowBatch(3);
assertTrue(rows.nextBatch(rb));
ListColumnVector r = (ListColumnVector) rb.cols[0];
// Cast verifies schema evolution took effect (would be LongColumnVector without evolution)
BytesColumnVector child = (BytesColumnVector) r.child;
assertEquals(0, r.childCount);
for (int i = 0; i < 3; i++) {
assertEquals(0, r.lengths[i], "row " + i + " should be empty array");
}
} finally {
fs.delete(testFilePath, false);
}
}
}
Loading