partScan = entry.getKey(); partNextKey = lookupResult.unfinishedRanges.get(0).getStartKey(); partNextKeyInclusive = lookupResult.unfinishedRanges.get(0).isStartKeyInclusive();
public static Range minimizeEndKeyTimeStamp(Range range) { Range seekRange = range; if (range.getEndKey() != null) { Key seekKey = seekRange.getEndKey(); if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) { seekKey = new Key(seekRange.getEndKey()); seekKey.setTimestamp(Long.MIN_VALUE); seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } else if (!range.isEndKeyInclusive()) { seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true); } } return seekRange; }
/** * Converts the given {@code Range} into the correct {@code Range} for this TermSource (per this * expected table structure) and then seeks this TermSource's SKVI. */ public void seek(Range originalRange) throws IOException { // the infinite start key is equivalent to a null startKey on the Range. if (!originalRange.isInfiniteStartKey()) { Key originalStartKey = originalRange.getStartKey(); // Pivot the provided range into the range for this term Key newKey = new Key(originalStartKey.getRow(), term, originalStartKey.getColumnQualifier(), originalStartKey.getTimestamp()); // Construct the new range, preserving the other attributes on the provided range. currentRange = new Range(newKey, originalRange.isStartKeyInclusive(), originalRange.getEndKey(), originalRange.isEndKeyInclusive()); } else { currentRange = originalRange; } LOG.trace("Seeking {} to {}", this, currentRange); iter.seek(currentRange, seekColfams, true); }
boolean ski = range.isStartKeyInclusive(); if (getStartKey() != null) { sk = getStartKey(); ski = isStartKeyInclusive(); && !(range.isStartKeyInclusive() && isEndKeyInclusive()))) { if (returnNullIfDisjoint) return null; } else if (beforeStartKey(range.getStartKey())) { sk = getStartKey(); ski = isStartKeyInclusive(); && !(range.isEndKeyInclusive() && isStartKeyInclusive()))) { if (returnNullIfDisjoint) return null;
@Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { final String tableName = OptUtil.getTableOpt(cl, shellState); final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState); final Range range = getRange(cl, interpeter); final Authorizations auths = getAuths(cl, shellState); final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow(); final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow(); try { final Text max = shellState.getAccumuloClient().tableOperations().getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive()); if (max != null) { shellState.getReader().println(max.toString()); } } catch (Exception e) { log.debug("Could not get shell state.", e); } return 0; }
public static Range maximizeStartKeyTimeStamp(Range range) { Range seekRange = range; if (range.getStartKey() != null) { Key seekKey = range.getStartKey(); if (range.getStartKey().getTimestamp() != Long.MAX_VALUE) { seekKey = new Key(seekRange.getStartKey()); seekKey.setTimestamp(Long.MAX_VALUE); seekRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive()); } else if (!range.isStartKeyInclusive()) { seekRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive()); } } return seekRange; }
/** * Possibly expand {@code range} to include everything for the key prefix we are working with. * That is, if our prefix is ROW_COLFAM, then we need to expand the range so we're sure to include * all entries having the same row and column family as the start/end of the range. * * @param range * the range to expand * @return the modified range */ protected Range computeReseekRange(Range range) { Key startKey = range.getStartKey(); boolean startKeyInclusive = range.isStartKeyInclusive(); // If anything after the prefix is set, then clip the key so we include // everything for the prefix. if (isSetAfterPart(startKey, getKeyPrefix())) { startKey = copyPartialKey(startKey, getKeyPrefix()); startKeyInclusive = true; } Key endKey = range.getEndKey(); boolean endKeyInclusive = range.isEndKeyInclusive(); if (isSetAfterPart(endKey, getKeyPrefix())) { endKey = endKey.followingKey(getKeyPrefix()); endKeyInclusive = true; } return new Range(startKey, startKeyInclusive, endKey, endKeyInclusive); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { topKey = null; topValue = null; Key sk = range.getStartKey(); if (sk != null && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0 && sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) { // assuming that we are seeking using a key previously returned by // this iterator // therefore go to the next row/cf Key followingRowKey = sk.followingKey(PartialKey.ROW_COLFAM); if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0) return; range = new Range(sk.followingKey(PartialKey.ROW_COLFAM), true, range.getEndKey(), range.isEndKeyInclusive()); } sourceIter.seek(range, columnFamilies, inclusive); prepKeys(); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { topKey = null; topValue = null; Key sk = range.getStartKey(); if (sk != null && sk.getColumnFamilyData().length() == 0 && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0 && sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) { // assuming that we are seeking using a key previously returned by this iterator // therefore go to the next row Key followingRowKey = sk.followingKey(PartialKey.ROW); if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0) return; range = new Range(sk.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } sourceIter.seek(range, columnFamilies, inclusive); prepKeys(); }
@Override public boolean isKeyInRange(Key currentKey, Range currentRange, String separator) { List<String> values = Arrays.asList(currentKey.getColumnQualifier().toString().split("\0")[0].split(separator)); List<String> startValues = Arrays.asList(currentRange.getStartKey().getColumnQualifier().toString().split("\0")[0].split(separator)); List<String> endValues = Arrays.asList(currentRange.getEndKey().getColumnQualifier().toString().split("\0")[0].split(separator)); return isInRange(values, startValues, currentRange.isStartKeyInclusive(), endValues, currentRange.isEndKeyInclusive()); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { seekRng = range; // seek to first entry inside range if (range.isInfiniteStartKey()) inner = new PeekingIterator1<>(allEntriesToInject.entrySet().iterator()); else if (range.isStartKeyInclusive()) inner = new PeekingIterator1<>(allEntriesToInject.tailMap(range.getStartKey()).entrySet().iterator()); else inner = new PeekingIterator1<>(allEntriesToInject.tailMap(range.getStartKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME)).entrySet().iterator()); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { // seek to first entry inside range if (range.isInfiniteStartKey()) inner = new PeekingIterator1<>(allEntriesToInject.entrySet().iterator()); else if (range.isStartKeyInclusive()) inner = new PeekingIterator1<>(allEntriesToInject.tailMap(range.getStartKey()).entrySet().iterator()); else inner = new PeekingIterator1<>(allEntriesToInject.tailMap(range.getStartKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME)).entrySet().iterator()); }
private static String normalizeStartRow(Range range) { Key startKey = range.getStartKey(); if (startKey == null) return null; String startRow = new String(startKey.getRowData().toArray(), StandardCharsets.UTF_8); if (!range.isStartKeyInclusive()) return startRow+'\0'; else return startRow; }
/** * Permute a "Document" Range to the equivalent "Field Index" Range for a Field:Term * * @param r * @return */ protected Range buildIndexRange(Range r) { Key startKey = permuteRangeKey(r.getStartKey(), r.isStartKeyInclusive()); Key endKey = permuteRangeKey(r.getEndKey(), r.isEndKeyInclusive()); return new Range(startKey, r.isStartKeyInclusive(), endKey, r.isEndKeyInclusive()); }
boolean ski = isStartKeyInclusive();
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { source.seek(range, columnFamilies, inclusive); lastKey = range.isInfiniteStartKey() ? EMPTY_KEY : range.getStartKey(); afterLastKey = !range.isInfiniteStartKey() && !range.isStartKeyInclusive(); tri = 0; findTop(); }
/** * Converts an Accumulo Range to a Fluo Span * * @param range Range * @return Span */ public static Span toSpan(Range range) { return new Span(toRowColumn(range.getStartKey()), range.isStartKeyInclusive(), toRowColumn(range.getEndKey()), range.isEndKeyInclusive()); }
/** * Converts an Accumulo Range to a Fluo Span * * @param range Range * @return Span */ public static Span toSpan(Range range) { return new Span(toRowColumn(range.getStartKey()), range.isStartKeyInclusive(), toRowColumn(range.getEndKey()), range.isEndKeyInclusive()); }
/** * Converts an Accumulo Range to a Fluo Span * * @param range Range * @return Span */ public static Span toSpan(Range range) { return new Span(toRowColumn(range.getStartKey()), range.isStartKeyInclusive(), toRowColumn(range.getEndKey()), range.isEndKeyInclusive()); }
public static org.apache.accumulo.proxy.thrift.Range toThrift(Range range) { if (range == null) { return null; } org.apache.accumulo.proxy.thrift.Range trange = new org.apache.accumulo.proxy.thrift.Range(); trange.setStart(toThrift(range.getStartKey())); trange.setStop(toThrift(range.getEndKey())); trange.setStartInclusive(range.isStartKeyInclusive()); trange.setStopInclusive(range.isEndKeyInclusive()); return trange; }