-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Refactory ColumnarRowIterator using LongIterator. #4992
Conversation
@@ -89,9 +95,11 @@ public Path filePath() { | |||
} | |||
|
|||
protected ColumnarRowIterator copy(ColumnVector[] vectors) { | |||
// We should call copy only when the iterator is at the beginning of the file. | |||
assert nextPos == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use checkPrecondition
@@ -77,10 +78,15 @@ public InternalRow next() { | |||
|
|||
@Override | |||
public long returnedPosition() { | |||
if (nextPos == 0) { | |||
return positions[0] - 1; | |||
for (int i = 0; i < nextPos - callReturnedPositionTimes; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for this.
@@ -52,16 +54,15 @@ public ColumnarRowIterator(Path filePath, ColumnarRow row, @Nullable Runnable re | |||
} | |||
|
|||
public void reset(long nextFilePos) { | |||
reset(LongIterator.fromRange(nextFilePos, nextFilePos + positions.length)); | |||
reset(LongIterator.fromRange(nextFilePos, nextFilePos + row.batch().getNumRows())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can rebase the master
@@ -38,9 +37,10 @@ public VectorizedColumnBatch batch() { | |||
|
|||
@Override | |||
protected VectorizedRowIterator copy(ColumnVector[] vectors) { | |||
assert nextPos == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use checkPrecondition
this.nextPos = 0; | ||
this.callReturnedPositionTimes = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returnedPositionIndex
?
@@ -42,7 +42,9 @@ public class ColumnarRowIterator extends RecyclableIterator<InternalRow> | |||
|
|||
protected int num; | |||
protected int nextPos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is OK to rename this to index.
93ec025
to
365c8ee
Compare
Looks good to me! |
Purpose
Using LongIterator instead of long[].
Tests
API and Format
Documentation