dlmarion commented on code in PR #5833: URL: https://github.com/apache/accumulo/pull/5833#discussion_r2307899360
########## core/src/main/java/org/apache/accumulo/core/file/FileSKVIterator.java: ########## @@ -20,17 +20,86 @@ import java.io.DataInputStream; import java.io.IOException; +import java.util.Objects; +import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.dataImpl.KeyExtent; import org.apache.accumulo.core.file.blockfile.impl.CacheProvider; import org.apache.accumulo.core.iteratorsImpl.system.InterruptibleIterator; import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl; +import org.apache.accumulo.core.util.RowRangeUtil; import org.apache.hadoop.io.Text; public interface FileSKVIterator extends InterruptibleIterator, AutoCloseable { - Text getFirstRow() throws IOException; - Text getLastRow() throws IOException; + /** + * Captures the row range that a file covers. This class can not represent infinite ranges. + */ + class FileRange { + public final Range rowRange; + public final boolean empty; + + public static final FileRange EMPTY = new FileRange(); + + public FileRange(Text startRow, Text endrow) { + this.rowRange = new Range(Objects.requireNonNull(startRow), Objects.requireNonNull(endrow)); + this.empty = false; + } + + private FileRange() { + this.rowRange = null; + this.empty = true; + } + + private FileRange(Range range) { + this.rowRange = RowRangeUtil.requireRowRange(Objects.requireNonNull(range)); + Objects.requireNonNull(rowRange.getStartKey()); + Objects.requireNonNull(rowRange.getEndKey()); + this.empty = false; + } + + public FileRange expand(FileRange other) { Review Comment: A comment about what this method does would be useful. I'm assuming that this method expands `this` FileRange to cover another? ########## core/src/main/java/org/apache/accumulo/core/iteratorsImpl/system/SequenceFileIterator.java: ########## @@ -118,13 +117,8 @@ public void close() throws IOException { } @Override - public Text getFirstRow() throws IOException { - throw new UnsupportedOperationException("getFirstKey() not supported"); - } - - @Override - public Text getLastRow() throws IOException { - throw new UnsupportedOperationException("getLastKey() not supported"); + public FileRange getFileRange() { + throw new UnsupportedOperationException("getRowRange() not supported"); Review Comment: ```suggestion throw new UnsupportedOperationException("getFileRange() not supported"); ``` -- 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. To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org