private boolean isRangeDone(byte[] row) { return row == null || RangeRequests.isLastRowName(row); }
private boolean isRangeDone(byte[] row) { return row == null || RangeRequests.isLastRowName(row); }
public static boolean isTerminalRow(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { return isFirstRowName(rowName); } else { return isLastRowName(rowName); } }
private boolean isEndOfColumnRange(byte[] lastCol, byte[] endCol) { return RangeRequests.isLastRowName(lastCol) || Arrays.equals(RangeRequests.nextLexicographicName(lastCol), endCol); }
public static boolean isFirstRowName(boolean reverse, @Nonnull byte[] name) { return reverse ? isLastRowName(name) : isFirstRowName(name); }
@Override public boolean hasNext(byte[] lastToken) { if (RangeRequests.isLastRowName(lastToken)) { return false; } else { return !Arrays.equals(RangeRequests.nextLexicographicName(lastToken), columnRangeSelection.getEndCol()); } }
private boolean isEndOfColumnRange(boolean completedCell, byte[] lastCol, int numRawResults, BatchColumnRangeSelection columnRangeSelection) { return (numRawResults < columnRangeSelection.getBatchHint()) || (completedCell && (RangeRequests.isLastRowName(lastCol) || Arrays.equals( RangeRequests.nextLexicographicName(lastCol), columnRangeSelection.getEndCol()))); }
public static <T> TokenBackedBasicResultsPage<RowResult<T>, byte[]> getRowResults( byte[] endExclusive, byte[] lastRow, SortedMap<byte[], SortedMap<byte[], T>> resultsByRow) { SortedMap<byte[], RowResult<T>> ret = RowResults.viewOfSortedMap(resultsByRow); if (lastRow == null || RangeRequests.isLastRowName(lastRow)) { return new SimpleTokenBackedResultsPage<>(endExclusive, ret.values(), false); } byte[] nextStart = RangeRequests.nextLexicographicName(lastRow); if (Arrays.equals(nextStart, endExclusive)) { return new SimpleTokenBackedResultsPage<>(endExclusive, ret.values(), false); } return new SimpleTokenBackedResultsPage<>(nextStart, ret.values(), true); }
private SortedMap<Cell, byte[]> getLocalWritesForColumnRange( TableReference tableRef, BatchColumnRangeSelection columnRangeSelection, byte[] row) { SortedMap<Cell, byte[]> writes = getLocalWrites(tableRef); Cell startCell; if (columnRangeSelection.getStartCol().length != 0) { startCell = Cell.create(row, columnRangeSelection.getStartCol()); } else { startCell = Cells.createSmallestCellForRow(row); } writes = writes.tailMap(startCell); if (RangeRequests.isLastRowName(row)) { return writes; } Cell endCell; if (columnRangeSelection.getEndCol().length != 0) { endCell = Cell.create(row, columnRangeSelection.getEndCol()); } else { endCell = Cells.createSmallestCellForRow(RangeRequests.nextLexicographicName(row)); } writes = writes.headMap(endCell); return writes; }
private NavigableMap<Cell, byte[]> getReadsInColumnRangeSkippingWrites( TableReference table, byte[] row, BatchColumnRangeSelection range) { NavigableMap<Cell, byte[]> reads = getReadsForTable(table); Cell startCell = Cells.createSmallestCellForRow(row); if ((range.getStartCol() != null) && (range.getStartCol().length > 0)) { startCell = Cell.create(row, range.getStartCol()); } reads = reads.tailMap(startCell, true); if ((range.getEndCol() != null) && (range.getEndCol().length > 0)) { Cell endCell = Cell.create(row, range.getEndCol()); reads = reads.headMap(endCell, false); } else if (!RangeRequests.isLastRowName(row)) { Cell endCell = Cells.createSmallestCellForRow(RangeRequests.nextLexicographicName(row)); reads = reads.headMap(endCell, false); } ConcurrentNavigableMap<Cell, byte[]> writes = writesByTable.get(table); if (writes != null) { reads = Maps.filterKeys(reads, Predicates.not(Predicates.in(writes.keySet()))); } return reads; }
private byte[] validateAndGetNextRowName(TableReference table, int limit, Transaction t1, Transaction t2, RangeRequest range) { BatchingVisitableView<RowResult<byte[]>> bv1 = BatchingVisitableView.of(t1.getRange(table, range)); List<RowResult<byte[]>> rrs1 = bv1.limit(limit).immutableCopy(); Map<Cell, byte[]> cells1 = Cells.convertRowResultsToCells(rrs1); BatchingVisitableView<RowResult<byte[]>> bv2 = BatchingVisitableView.of(t2.getRange(table, range)); List<RowResult<byte[]>> rrs2 = bv2.limit(limit).immutableCopy(); Map<Cell, byte[]> cells2 = Cells.convertRowResultsToCells(rrs2); validateEquality(cells1, cells2); if (rrs1.isEmpty()) { return null; } byte[] lastRow = rrs1.get(rrs1.size() - 1).getRowName(); if (RangeRequests.isLastRowName(lastRow)) { return null; } return RangeRequests.nextLexicographicName(lastRow); }
private boolean isRangeDone(byte[] row) { return row == null || RangeRequests.isLastRowName(row); }
private boolean isRangeDone(byte[] row) { return row == null || RangeRequests.isLastRowName(row); }
public static boolean isTerminalRow(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { return isFirstRowName(rowName); } else { return isLastRowName(rowName); } }
private boolean isEndOfColumnRange(byte[] lastCol, byte[] endCol) { return RangeRequests.isLastRowName(lastCol) || Arrays.equals(RangeRequests.nextLexicographicName(lastCol), endCol); }
public static boolean isFirstRowName(boolean reverse, @Nonnull byte[] name) { return reverse ? isLastRowName(name) : isFirstRowName(name); }
@Override public boolean hasNext(byte[] lastToken) { if (RangeRequests.isLastRowName(lastToken)) { return false; } else { return !Arrays.equals(RangeRequests.nextLexicographicName(lastToken), columnRangeSelection.getEndCol()); } }
private boolean isEndOfColumnRange(boolean completedCell, byte[] lastCol, int numRawResults, BatchColumnRangeSelection columnRangeSelection) { return (numRawResults < columnRangeSelection.getBatchHint()) || (completedCell && (RangeRequests.isLastRowName(lastCol) || Arrays.equals( RangeRequests.nextLexicographicName(lastCol), columnRangeSelection.getEndCol()))); }
public static <T> TokenBackedBasicResultsPage<RowResult<T>, byte[]> getRowResults( byte[] endExclusive, byte[] lastRow, SortedMap<byte[], SortedMap<byte[], T>> resultsByRow) { SortedMap<byte[], RowResult<T>> ret = RowResults.viewOfSortedMap(resultsByRow); if (lastRow == null || RangeRequests.isLastRowName(lastRow)) { return new SimpleTokenBackedResultsPage<>(endExclusive, ret.values(), false); } byte[] nextStart = RangeRequests.nextLexicographicName(lastRow); if (Arrays.equals(nextStart, endExclusive)) { return new SimpleTokenBackedResultsPage<>(endExclusive, ret.values(), false); } return new SimpleTokenBackedResultsPage<>(nextStart, ret.values(), true); }
private SortedMap<Cell, byte[]> getLocalWritesForColumnRange( TableReference tableRef, BatchColumnRangeSelection columnRangeSelection, byte[] row) { SortedMap<Cell, byte[]> writes = getLocalWrites(tableRef); Cell startCell; if (columnRangeSelection.getStartCol().length != 0) { startCell = Cell.create(row, columnRangeSelection.getStartCol()); } else { startCell = Cells.createSmallestCellForRow(row); } writes = writes.tailMap(startCell); if (RangeRequests.isLastRowName(row)) { return writes; } Cell endCell; if (columnRangeSelection.getEndCol().length != 0) { endCell = Cell.create(row, columnRangeSelection.getEndCol()); } else { endCell = Cells.createSmallestCellForRow(RangeRequests.nextLexicographicName(row)); } writes = writes.headMap(endCell); return writes; }