omalley commented on a change in pull request #652:
URL: https://github.com/apache/orc/pull/652#discussion_r598019072
##########
File path: java/core/src/java/org/apache/orc/impl/InStream.java
##########
@@ -397,13 +397,14 @@ public String toString() {
}
}
- private static class CompressedStream extends InStream {
+ static class CompressedStream extends InStream {
private final int bufferSize;
private ByteBuffer uncompressed;
private final CompressionCodec codec;
protected ByteBuffer compressed;
protected DiskRangeList currentRange;
private boolean isUncompressedOriginal;
+ protected long currentCompressedStart;
Review comment:
This should be initialized to -1 so that we don't have someone seek to 0
and get incorrect data.
##########
File path: java/core/src/test/org/apache/orc/impl/TestInStream.java
##########
@@ -19,6 +19,9 @@
package org.apache.orc.impl;
Review comment:
It would be nice to have a test case for blocks that used the original
bytes (header.isOriginal).
##########
File path: java/core/src/java/org/apache/orc/impl/InStream.java
##########
@@ -551,15 +556,20 @@ public void changeIv(Consumer<byte[]> modifier) {
@Override
public void seek(PositionProvider index) throws IOException {
- seek(index.getNext());
+ boolean seeked = seek(index.getNext());
long uncompressedBytes = index.getNext();
- if (uncompressedBytes != 0) {
- readHeader();
- uncompressed.position(uncompressed.position() +
- (int) uncompressedBytes);
- } else if (uncompressed != null) {
- // mark the uncompressed buffer as done
- uncompressed.position(uncompressed.limit());
+ if (!seeked && uncompressed != null) {
Review comment:
Can we get into the case of !seeked && uncompressed == null? I suspect
not, but this code would probably be doing the wrong thing by ignoring the case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]