本文整理汇总了Java中org.apache.accumulo.core.data.Key.compareColumnFamily方法的典型用法代码示例。如果您正苦于以下问题:Java Key.compareColumnFamily方法的具体用法?Java Key.compareColumnFamily怎么用?Java Key.compareColumnFamily使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.data.Key
的用法示例。
在下文中一共展示了Key.compareColumnFamily方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findCount
import org.apache.accumulo.core.data.Key; //导入方法依赖的package包/类
private Entry<Key,Value> findCount(Entry<Key,Value> entry, Iterator<Entry<Key,Value>> iterator, CountValue cv) {
Key key = entry.getKey();
Text currentRow = key.getRow();
if (key.compareColumnQualifier(QueryUtil.COUNTS_COLQ) == 0)
cv.set(entry.getValue());
while (iterator.hasNext()) {
entry = iterator.next();
entriesScanned++;
key = entry.getKey();
if (key.compareRow(currentRow) != 0)
return entry;
if (key.compareColumnFamily(QueryUtil.DIR_COLF) == 0 && key.compareColumnQualifier(QueryUtil.COUNTS_COLQ) == 0) {
cv.set(entry.getValue());
}
}
return null;
}
示例2: calculateCounts
import org.apache.accumulo.core.data.Key; //导入方法依赖的package包/类
private void calculateCounts(Scanner scanner, int depth, BatchWriter batchWriter) throws Exception {
scanner.setRange(new Range(String.format("%03d", depth), true, String.format("%03d", depth + 1), false));
CountValue countVal = new CountValue();
Iterator<Entry<Key,Value>> iterator = scanner.iterator();
String currentDir = null;
Entry<Key,Value> entry = null;
if (iterator.hasNext()) {
entry = iterator.next();
entriesScanned++;
}
while (entry != null) {
Key key = entry.getKey();
String dir = extractDir(key);
if (currentDir == null) {
currentDir = dir;
} else if (!currentDir.equals(dir)) {
batchWriter.addMutation(createMutation(depth - 1, currentDir, countVal));
inserts++;
currentDir = dir;
countVal.clear();
}
// process a whole row
if (key.compareColumnFamily(QueryUtil.DIR_COLF) == 0) {
CountValue tmpCount = new CountValue();
entry = findCount(entry, iterator, tmpCount);
if (tmpCount.dirCount == 0 && tmpCount.fileCount == 0) {
// in this case the higher depth will not insert anything if the
// dir has no children, so insert something here
Mutation m = new Mutation(key.getRow());
m.put(QueryUtil.DIR_COLF, QueryUtil.COUNTS_COLQ, visibility, tmpCount.toValue());
batchWriter.addMutation(m);
inserts++;
}
countVal.incrementRecursive(tmpCount);
countVal.incrementDirs();
} else {
entry = consumeRow(entry, iterator);
countVal.incrementFiles();
}
}
if (currentDir != null) {
batchWriter.addMutation(createMutation(depth - 1, currentDir, countVal));
inserts++;
}
}