Skip to content
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 @@ -287,6 +287,11 @@ public interface LongEncodingReader

int read(long[] out, int outPosition, int[] indexes, int length, int indexOffset, int limit);

/**
* Duplicates this reader, creating a new reader that does not share any state. Important to achieve thread-safety,
* because a common pattern is to duplicate a reader multiple times and then call {@link #setBuffer} on the
* various duplicates.
*/
LongEncodingReader duplicate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ public int read(long[] out, int outPosition, int[] indexes, int length, int inde
@Override
public CompressionFactory.LongEncodingReader duplicate()
{
return this;
return new LongsLongEncodingReader(buffer.getByteBuffer(), buffer.getTypeByteOrder());
}
}