Details
-
Improvement
-
Status: Resolved
-
Critical
-
Resolution: Not A Problem
-
None
-
None
-
None
Description
There's one little mistake in the Java Core Example. The for loops starts with a batch.size++:
for(int r=0; r < 10000; ++r) {
int row = batch.size++;
x.vector[row] = r;
y.vector[row] = r * 3;
// If the batch is full, write it out and start over.
if (batch.size == batch.getMaxSize())
}
If you start with a batch.size++ the first index will be 1, so the first entry in the orc file will be empty.
Correct is:
for(int r=0; r < 10000; ++r) {
int row = batch.size;
x.vector[row] = r;
y.vector[row] = r * 3;
// If the batch is full, write it out and start over.
if (batch.size == batch.getMaxSize()) { writer.addRowBatch(batch); batch.reset(); }
batch.size++;
}
Already tested it in scala.
Attachments
Issue Links
- links to