org.apache.accumulo.core.data.Range.isInfiniteStopKey()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.apache.accumulo.core.data.Range.isInfiniteStopKey方法的一些代码示例,展示了Range.isInfiniteStopKey的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.isInfiniteStopKey方法的具体详情如下:
包路径:org.apache.accumulo.core.data.Range
类名称:Range
方法名:isInfiniteStopKey

Range.isInfiniteStopKey介绍

[英]Gets whether the end key is positive infinity.
[中]获取结束键是否为正无穷大。

代码示例

代码示例来源:origin: prestodb/presto

private static boolean isExact(Range range)
{
  return !range.isInfiniteStartKey() && !range.isInfiniteStopKey() &&
      range.getStartKey().followingKey(PartialKey.ROW).equals(range.getEndKey());
}

代码示例来源:origin: apache/accumulo

public static long getRangeLength(Range range) {
 Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE})
   : range.getStartKey().getRow();
 Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE})
   : range.getEndKey().getRow();
 int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
 long diff = 0;
 byte[] start = startRow.getBytes();
 byte[] stop = stopRow.getBytes();
 for (int i = 0; i < maxCommon; ++i) {
  diff |= 0xff & (start[i] ^ stop[i]);
  diff <<= Byte.SIZE;
 }
 if (startRow.getLength() != stopRow.getLength())
  diff |= 0xff;
 return diff + 1;
}

代码示例来源:origin: org.apache.accumulo/accumulo-core

public static long getRangeLength(Range range) throws IOException {
 Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE})
   : range.getStartKey().getRow();
 Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE})
   : range.getEndKey().getRow();
 int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
 long diff = 0;
 byte[] start = startRow.getBytes();
 byte[] stop = stopRow.getBytes();
 for (int i = 0; i < maxCommon; ++i) {
  diff |= 0xff & (start[i] ^ stop[i]);
  diff <<= Byte.SIZE;
 }
 if (startRow.getLength() != stopRow.getLength())
  diff |= 0xff;
 return diff + 1;
}

代码示例来源:origin: org.apache.accumulo/accumulo-client-mapreduce

public static long getRangeLength(Range range) throws IOException {
 Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE})
   : range.getStartKey().getRow();
 Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE})
   : range.getEndKey().getRow();
 int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
 long diff = 0;
 byte[] start = startRow.getBytes();
 byte[] stop = stopRow.getBytes();
 for (int i = 0; i < maxCommon; ++i) {
  diff |= 0xff & (start[i] ^ stop[i]);
  diff <<= Byte.SIZE;
 }
 if (startRow.getLength() != stopRow.getLength())
  diff |= 0xff;
 return diff + 1;
}

代码示例来源:origin: org.apache.accumulo/accumulo-test

public static Text getColumnQualifier(Range range) {
  return range.isInfiniteStopKey() ? EMPTY : range.getEndKey().getRow();
 }
}

代码示例来源:origin: NationalSecurityAgency/datawave

/**
 * This implementation of length is only an estimate, it does not provide exact values. Do not have your code rely on this return value.
 */
public long getLength() throws IOException {
  Range firstRange = ranges.first();
  Range listRange = ranges.last();
  Text startRow = firstRange.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE}) : firstRange.getStartKey().getRow();
  Text stopRow = listRange.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE}) : listRange.getEndKey().getRow();
  int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
  long diff = 0;
  
  byte[] start = startRow.getBytes();
  byte[] stop = stopRow.getBytes();
  for (int i = 0; i < maxCommon; ++i) {
    diff |= 0xff & (start[i] ^ stop[i]);
    diff <<= Byte.SIZE;
  }
  
  if (startRow.getLength() != stopRow.getLength())
    diff |= 0xff;
  
  return diff + 1;
}

代码示例来源:origin: org.apache.accumulo/accumulo-hadoop-mapreduce

public static long getRangeLength(Range range) {
 Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE})
   : range.getStartKey().getRow();
 Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE})
   : range.getEndKey().getRow();
 int maxCommon = Math.min(7, Math.min(startRow.getLength(), stopRow.getLength()));
 long diff = 0;
 byte[] start = startRow.getBytes();
 byte[] stop = stopRow.getBytes();
 for (int i = 0; i < maxCommon; ++i) {
  diff |= 0xff & (start[i] ^ stop[i]);
  diff <<= Byte.SIZE;
 }
 if (startRow.getLength() != stopRow.getLength())
  diff |= 0xff;
 return diff + 1;
}

代码示例来源:origin: Accla/graphulo

public static String rangesToD4MString(Collection<Range> ranges, char sep) {
 if (ranges == null || ranges.isEmpty())
  return "";
 ranges = Range.mergeOverlapping(ranges);
 StringBuilder sb = new StringBuilder();
 String infEnd = null;
 for (Range range : ranges) {
  if (range.isInfiniteStartKey() && range.isInfiniteStopKey())
   return sb.append(':').append(sep).toString();
  else if (range.isInfiniteStartKey()) {
   String endRow = normalizeEndRow(range); assert endRow != null;
   sb.insert(0, ":" + sep+endRow+sep);
  } else if (range.isInfiniteStopKey()) {
   infEnd = normalizeStartRow(range); assert infEnd != null;
  } else {
   String startRow = normalizeStartRow(range),
     endRow = normalizeEndRow(range);
   assert startRow != null && endRow != null;
   if (startRow.equals(endRow))
    sb.append(startRow).append(sep);
   else
    sb.append(startRow).append(sep).append(':').append(sep).append(endRow).append(sep);
  }
 }
 if (infEnd != null)
  sb.append(infEnd).append(sep).append(':').append(sep);
 return sb.toString();
}

代码示例来源:origin: Accla/graphulo

/** Iterate over target ranges in order, masked by seekRange.
 * Only iterates over target ranges that intersect the seekRange. */
public PeekingIterator1<Range> iteratorWithRangeMask(Range seekRange) {
 if (seekRange.isInfiniteStartKey() && seekRange.isInfiniteStopKey())
  return new PeekingIterator1<>(targetRanges.iterator());
 else if (seekRange.isInfiniteStartKey())
  return new RangeSetIter(targetRanges.iterator(), seekRange);
 else {
  // find first range whose end key >= the start key of seekRange
  PeekingIterator1<Range> pi = getFirstRangeStarting(seekRange, targetRanges);
  return new RangeSetIter(pi, seekRange);
 }
}

代码示例来源:origin: Accla/graphulo

/**
 * Pad a range with a prefix, so the new range points to entries
 * that begin with the prefix and then satisfy the original range.
 * Only uses the Row field of the original Range; discards the rest.
 * @param pre The prefix
 * @param rold The original Range
 * @return New Range of the prefix plus the original
 */
public static Range prependPrefixToRange(String pre, Range rold) {
 if (pre == null || pre.isEmpty())
  return rold;
 if (rold.isInfiniteStopKey() && rold.isInfiniteStartKey())
  return Range.prefix(pre);
 if (rold.isInfiniteStartKey())
  return new Range(pre, true, pre+normalizeEndRow(rold), true);
 if (rold.isInfiniteStopKey())
  return new Range(pre+normalizeStartRow(rold), true,
    Range.followingPrefix(new Text(pre)).toString(), false);
 return new Range(pre+normalizeStartRow(rold), true,
   pre+normalizeEndRow(rold), true);
}

代码示例来源:origin: NationalSecurityAgency/datawave

public static boolean allDocSpecific(Collection<Range> ranges) {
  for (Range range : ranges) {
    if (range.isInfiniteStartKey() || range.isInfiniteStopKey())
      return false;
    Key startKey = range.getStartKey();
    // 1) it's not a shard, meaning that we don't have a shard specific range or doc specific range
    // 2) cf is empty meaning we have a day range or shard specific range
    if (!isShard(startKey.getRow().toString()) || startKey.getColumnFamilyData().length() == 0) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: Accla/graphulo

@Override
 public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
  if (!range.isInfiniteStartKey() || !range.isInfiniteStopKey())
   log.warn("Range is not infinite: "+range);
  source.seek(range, columnFamilies, inclusive);

  IteratorAdapter ia = new IteratorAdapter(source);
  SortedMap<Key, Value> map = MemMatrixUtil.matrixToMap(new TreeMap<Key, Value>(),
    MemMatrixUtil.doInverse(MemMatrixUtil.buildMatrix(ia, matrixSize), numIterations));

//    DebugUtil.printMapFull(map.entrySet().iterator());
  mapIterator = new MapIterator(map);
  mapIterator.init(null, null, null);
  mapIterator.seek(range, columnFamilies, inclusive);
 }

代码示例来源:origin: Accla/graphulo

end = r.isInfiniteStopKey() ? null : r.getEndKey().getRow().toString();
boolean startInclusive = true, endInclusive = true;

代码示例来源:origin: Accla/graphulo

if (ranges.size() == 1) { // single range - use ColumnSliceFilter
 Range r = ranges.first();
 if (r.isInfiniteStartKey() && r.isInfiniteStopKey())
  return;               // Infinite case: no filtering.
 s = new IteratorSetting(priority, ColumnSliceFilter.class);
   true, r.isInfiniteStopKey() ? null : r.getEndKey().getRow().toString(), true);

代码示例来源:origin: Accla/graphulo

true, r.isInfiniteStopKey() ? null : r.getEndKey().getRow().toString(), true);

代码示例来源:origin: Accla/graphulo

ret2 = buildMapWholeRow(rsiFlag ? rsi : source2);
if (ret2 == null && !rsiFlag && !seekRange.isInfiniteStopKey()) {
 rsiFlag = false;
 ret2 = buildMapWholeRow(source2);
 if (ret2 == null && !seekRange.isInfiniteStopKey()) {

代码示例来源:origin: Accla/graphulo

/**
 * Advance to the first subset range whose end key >= the seek start key.
 */
public static PeekingIterator1<Range> getFirstRangeStarting(Range seekRange, SortedSet<Range> rowRanges) {
 PeekingIterator1<Range> iter = new PeekingIterator1<>(rowRanges.iterator());
 Key seekRangeStart = seekRange.getStartKey();
 if (seekRangeStart != null)
  while (iter.hasNext() && !iter.peek().isInfiniteStopKey()
    && (
    iter.peek().getEndKey().compareTo(seekRangeStart) < 0 ||
      (iter.peek().getEndKey().equals(seekRangeStart) && !seekRange.isEndKeyInclusive())
  ))
   iter.next();
 return iter;
}

代码示例来源:origin: apache/incubator-rya

if (!r1.isInfiniteStopKey()) {
  if (r2.isInfiniteStopKey()) {
    return false;

代码示例来源:origin: NationalSecurityAgency/datawave

if (r.isInfiniteStartKey() || r.isInfiniteStopKey()) {
  return false;
} else {

代码示例来源:origin: Accla/graphulo

/**
 * Advance to the first subset range whose end key >= the seek start key.
 */
public static Iterator<Range> getFirstRangeStarting(PeekingIterator1<Range> iter, Range seekRange) {
 if (!seekRange.isInfiniteStartKey())
  while (iter.hasNext() && !iter.peek().isInfiniteStopKey()
    && ((iter.peek().getEndKey().equals(seekRange.getStartKey()) && !seekRange.isEndKeyInclusive())
    || iter.peek().getEndKey().compareTo(seekRange.getStartKey()) < 0)) {
   iter.next();
  }
 return iter;
}

相关文章