Skip to content
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

Add Default RecordReader Next Implementation #14108

Merged
merged 4 commits into from
Oct 3, 2024
Merged
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 @@ -47,7 +47,7 @@ class PinotBufferedRecordReader extends RecordReader {
readCursor < recordBuffer.size()
}

def next(): GenericRow = {
override def next(): GenericRow = {
readCursor += 1
recordBuffer.get(readCursor - 1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ public boolean hasNext() {
}
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
if (_recordPurger == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ public boolean hasNext() {
return _nextRowId < _endRowId;
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
int rowId = _sortedRowIds != null ? _sortedRowIds[_nextRowId++] : _nextRowId++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ public boolean hasNext() {
return _avroReader.hasNext();
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ public boolean hasNext() {
return _iterator.hasNext();
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public boolean hasNext() {
return _iterator.hasNext();
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
Map<String, Object> record = _iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@ public boolean hasNext() {
return _hasNext;
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ public boolean hasNext() {
return _nextRecord != null;
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ public boolean hasNext() {
return hasNext();
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ public boolean hasNext() {
return _internalParquetRecordReader.hasNext();
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ public boolean hasNext() {
return _hasNext;
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ public boolean hasNext() {
return _hasNext;
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ public boolean hasNext() {
return false;
}

@Override
public GenericRow next()
throws IOException {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public boolean hasNext() {
return _nextRowId < _numRows;
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
reuse.init(_rows.get(_nextRowId++));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ public boolean hasNext() {
}
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
if (_sortOrder != null) {
Expand Down Expand Up @@ -144,7 +139,8 @@ public GenericRow next(GenericRow reuse) {
}

@Override
public void rewind() {
public void rewind()
throws IOException {
for (PinotSegmentRecordReader recordReader : _recordReaders) {
recordReader.rewind();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ public boolean hasNext() {
return _nextDocId < _numDocs;
}

@Override
public GenericRow next() {
return next(new GenericRow());
}

@Override
public GenericRow next(GenericRow reuse) {
if (_sortedDocIds == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void init(File dataFile, @Nullable Set<String> fieldsToRead, @Nullable RecordRea

/**
* Get the next record.
*
* TODO: Add default implementation because all the override implementations are the same
*/
GenericRow next()
throws IOException;
default GenericRow next()
throws IOException {
return next(new GenericRow());
}

/**
* Get the next record. Re-use the given row to reduce garbage.
Expand Down
Loading