Skip to content

Commit

Permalink
Override skip method
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengJie1053 committed Jan 22, 2024
1 parent 8d5c5ac commit 5c4c20f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ public MetaData getMetaData() {

@Override
public int skip(int recordNum) throws IOException {
throw new UnsupportedOperationException("Storeage Unsupported type: skip");
if (recordNum < 0) return -1;

for (int i = recordNum; i > 0; i--) {
try {
hasNext();
} catch (Throwable t) {
return recordNum - i;
}
}
return recordNum;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ public MetaData getMetaData() {

@Override
public int skip(int recordNum) throws IOException {
throw new UnsupportedOperationException("Storeage Unsupported type: skip");
if (recordNum < 0) return -1;

for (int i = recordNum; i > 0; i--) {
try {
this.record = parquetReader.read();
} catch (Throwable t) {
return recordNum - i;
}
}
return recordNum;
}

@Override
Expand Down

0 comments on commit 5c4c20f

Please sign in to comment.