本文整理了Java中org.apache.accumulo.core.data.Range.mergeOverlapping
方法的一些代码示例,展示了Range.mergeOverlapping
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.mergeOverlapping
方法的具体详情如下:
包路径:org.apache.accumulo.core.data.Range
类名称:Range
方法名:mergeOverlapping
[英]Merges overlapping and adjacent ranges. For example given the following input:
[a,c], (c, d], (g,m), (j,t]
the following ranges would be returned:
[a,d], (g,t]
[中]合并重叠区域和相邻区域。例如,给定以下输入:
[a,c], (c, d], (g,m), (j,t]
将返回以下范围:
[a,d], (g,t]
代码示例来源:origin: apache/accumulo
private synchronized void lookup(List<Range> ranges, ResultReceiver receiver)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
List<Column> columns = new ArrayList<>(options.fetchedColumns);
ranges = Range.mergeOverlapping(ranges);
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
binRanges(locator, ranges, binnedRanges);
doLookups(binnedRanges, receiver, columns);
}
代码示例来源:origin: apache/accumulo
lookups = Range.mergeOverlapping(lookups);
代码示例来源:origin: apache/accumulo
.mergeOverlapping(Lists.transform(entry.getValue(), tm -> tm.getExtent().toDataRange()));
List<TRowRange> ranges = merged.stream().map(r -> toClippedExtent(r).toThrift())
代码示例来源:origin: apache/accumulo
ranges = Range.mergeOverlapping(ranges);
if (ranges.size() > 1) {
Collections.sort(ranges);
代码示例来源:origin: apache/accumulo
"AutoAdjustRanges must be enabled when using BatchScanner optimization");
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges())
: tableConfig.getRanges();
if (ranges.isEmpty()) {
代码示例来源:origin: apache/accumulo
"AutoAdjustRanges must be enabled when using BatchScanner optimization");
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges())
: tableConfig.getRanges();
if (ranges.isEmpty()) {
代码示例来源:origin: Accla/graphulo
/** Set the target ranges that we will iterator over, before applying a "seek range mask".
* Merges overlapping ranges together. Infinite range by default. */
public void setTargetRanges(Collection<Range> ranges) {
targetRanges = new TreeSet<>(Range.mergeOverlapping(new TreeSet<>(ranges)));
}
代码示例来源:origin: Accla/graphulo
/**
* Parse string s in the Matlab format "row1,row5,row7,:,row9,w,:,z,zz,:,"
* Does not have to be ordered but cannot overlap.
*
* @param s -
* @return a bunch of ranges
*/
static SortedSet<Range> parseRanges(String s) {
Collection<Range> rngs = GraphuloUtil.d4mRowToRanges(s);
rngs = Range.mergeOverlapping(rngs);
return new TreeSet<>(rngs);
}
代码示例来源:origin: Accla/graphulo
/**
* Parse string s in the Matlab format "row1,row5,row7,:,row9,w,:,z,zz,:,"
* Does not have to be ordered but cannot overlap.
*
* @param s -
* @return a bunch of ranges
*/
static SortedSet<Range> parseRanges(String s) {
SortedSet<Range> rngs = GraphuloUtil.d4mRowToRanges(s);
return new TreeSet<>(Range.mergeOverlapping(rngs));
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
private synchronized void lookup(List<Range> ranges, ResultReceiver receiver)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
List<Column> columns = new ArrayList<>(options.fetchedColumns);
ranges = Range.mergeOverlapping(ranges);
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
binRanges(locator, ranges, binnedRanges);
doLookups(binnedRanges, receiver, columns);
}
代码示例来源:origin: com.github.hyukjinkwon/hive-accumulo-handler
protected Object processOrOpNode(Node nd, Object[] nodeOutputs) {
List<Range> orRanges = new ArrayList<Range>(nodeOutputs.length);
for (Object nodeOutput : nodeOutputs) {
if (nodeOutput instanceof Range) {
orRanges.add((Range) nodeOutput);
} else if (nodeOutput instanceof List) {
@SuppressWarnings("unchecked")
List<Range> childRanges = (List<Range>) nodeOutput;
orRanges.addAll(childRanges);
} else {
LOG.error("Expected Range from {} but got {}", nd, nodeOutput);
throw new IllegalArgumentException("Expected Range but got "
+ nodeOutput.getClass().getName());
}
}
// Try to merge multiple ranges together
if (orRanges.size() > 1) {
return Range.mergeOverlapping(orRanges);
} else if (1 == orRanges.size()) {
// Return just the single Range
return orRanges.get(0);
} else {
// No ranges, just return the empty list
return orRanges;
}
}
代码示例来源:origin: org.apache.hive/hive-accumulo-handler
protected Object processOrOpNode(Node nd, Object[] nodeOutputs) {
List<Range> orRanges = new ArrayList<Range>(nodeOutputs.length);
for (Object nodeOutput : nodeOutputs) {
if (nodeOutput instanceof Range) {
orRanges.add((Range) nodeOutput);
} else if (nodeOutput instanceof List) {
@SuppressWarnings("unchecked")
List<Range> childRanges = (List<Range>) nodeOutput;
orRanges.addAll(childRanges);
} else {
LOG.error("Expected Range from {} but got {}", nd, nodeOutput);
throw new IllegalArgumentException("Expected Range but got "
+ nodeOutput.getClass().getName());
}
}
// Try to merge multiple ranges together
if (orRanges.size() > 1) {
return Range.mergeOverlapping(orRanges);
} else if (1 == orRanges.size()) {
// Return just the single Range
return orRanges.get(0);
} else {
// No ranges, just return the empty list
return orRanges;
}
}
代码示例来源: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: dbs-leipzig/gradoop
/**
* create a predicate within a certain id ranges
*
* @param query element query
* @param <T> epgm element type
* @return accumulo predicate
*/
public static <T extends EPGMElement> AccumuloQueryHolder<T> create(
@Nonnull ElementQuery<AccumuloElementFilter<T>> query
) {
List<Range> ranges = Range.mergeOverlapping(Optional.ofNullable(query.getQueryRanges())
.orElse(GradoopIdSet.fromExisting())
.stream()
.map(GradoopId::toString)
.map(Range::exact)
.collect(Collectors.toList()));
return new AccumuloQueryHolder<>(
query.getQueryRanges() == null ? null : ranges,
query.getFilterPredicate());
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
lookups = Range.mergeOverlapping(lookups);
代码示例来源:origin: org.apache.accumulo/accumulo-test
public MerkleTreeNode(List<MerkleTreeNode> children, String digestAlgorithm)
throws NoSuchAlgorithmException {
level = 0;
this.children = new ArrayList<>(children.size());
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
Range childrenRange = null;
for (MerkleTreeNode child : children) {
this.children.add(child.getRange());
level = Math.max(child.getLevel(), level);
digest.update(child.getHash());
if (null == childrenRange) {
childrenRange = child.getRange();
} else {
List<Range> overlappingRanges = Range
.mergeOverlapping(Arrays.asList(childrenRange, child.getRange()));
if (1 != overlappingRanges.size()) {
log.error("Tried to merge non-contiguous ranges: {} {}", childrenRange, child.getRange());
throw new IllegalArgumentException(
"Ranges must be contiguous: " + childrenRange + ", " + child.getRange());
}
childrenRange = overlappingRanges.get(0);
}
}
// Our actual level is one more than the highest level of our children
level++;
// Roll the hash up the tree
hash = digest.digest();
// Set the range to be the merged result of the children
range = childrenRange;
}
代码示例来源:origin: NationalSecurityAgency/datawave
/**
* Return the lists of computed slit points
*/
public List<InputSplit> getSplits(JobContext job) throws IOException {
AccumuloHelper cbHelper = new AccumuloHelper();
cbHelper.setup(job.getConfiguration());
String tableName = BulkInputFormat.getTablename(job.getConfiguration());
boolean autoAdjust = BulkInputFormat.getAutoAdjustRanges(job.getConfiguration());
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(BulkInputFormat.getRanges(job.getConfiguration())) : BulkInputFormat.getRanges(job
.getConfiguration());
if (ranges.isEmpty()) {
ranges = Lists.newArrayListWithCapacity(1);
ranges.add(new Range());
}
List<InputSplit> inputSplits = Lists.newArrayList();
try {
inputSplits = computeSplitPoints(job, tableName, ranges);
} catch (TableNotFoundException | AccumuloException | AccumuloSecurityException | InterruptedException e) {
throw new IOException(e);
}
return inputSplits;
}
代码示例来源:origin: NationalSecurityAgency/datawave
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(BulkInputFormat.getRanges(job.getConfiguration())) : BulkInputFormat.getRanges(job
.getConfiguration());
代码示例来源:origin: org.apache.accumulo/accumulo-server
ranges = Range.mergeOverlapping(ranges);
if (ranges.size() > 1) {
Collections.sort(ranges);
代码示例来源:origin: org.apache.accumulo/accumulo-tserver
ranges = Range.mergeOverlapping(ranges);
if (ranges.size() > 1) {
Collections.sort(ranges);
内容来源于网络,如有侵权,请联系作者删除!