本文整理了Java中org.apache.accumulo.core.data.Key.<init>()
方法的一些代码示例,展示了Key.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.<init>()
方法的具体详情如下:
包路径:org.apache.accumulo.core.data.Key
类名称:Key
方法名:<init>
[英]Creates a key with empty row, empty column family, empty column qualifier, empty column visibility, timestamp Long#MAX_VALUE, and delete marker false.
[中]创建具有空行、空列族、空列限定符、空列可见性、时间戳Long#MAX_值和delete marker false的键。
代码示例来源:origin: prestodb/presto
/**
* Gets a Boolean value indicating if the given value is in one of the Ranges in the given collection
*
* @param text Text object to check against the Range collection
* @param ranges Ranges to look into
* @return True if the text object is in one of the ranges, false otherwise
*/
private static boolean inRange(Text text, Collection<Range> ranges)
{
Key kCq = new Key(text);
return ranges.stream().anyMatch(r -> !r.beforeStartKey(kCq) && !r.afterEndKey(kCq));
}
}
代码示例来源:origin: prestodb/presto
Key defaultTabletRow = new Key(tableId + '<');
Key start = new Key(tableId);
Key end = defaultTabletRow.followingKey(PartialKey.ROW);
scanner.setRange(new Range(start, end));
代码示例来源:origin: apache/accumulo
@Override
public Key build() {
return new Key(this.row, this.rowOffset, this.rowLength, this.family, this.familyOffset,
this.familyLength, this.qualifier, this.qualifierOffset, this.qualifierLength,
this.visibility, this.visibilityOffset, this.visibilityLength, this.timestamp,
this.deleted, false);
}
}
代码示例来源:origin: prestodb/presto
protected void deserializeData(AccumuloRowSerializer serializer, byte[] data)
{
Mutation m = new Mutation("row");
m.put(b("a"), b("a"), data);
Key key = new Key(b("row"), b("a"), b("b"), b(), 0, false);
Value value = new Value(data);
serializer.setMapping(COLUMN_NAME, "a", "b");
serializer.deserialize(new SimpleImmutableEntry<>(key, value));
}
代码示例来源:origin: apache/accumulo
private void setFirstKey(Key key) {
if (firstKey != null)
throw new IllegalStateException();
this.firstKey = new Key(key);
}
代码示例来源:origin: apache/accumulo
@Override
protected Key buildKey(Text partition, Text term) {
Text colq = new Text(term);
return new Key(partition, indexColf, colq);
}
代码示例来源:origin: apache/accumulo
/**
* Returns a Range that covers all rows beginning with a prefix.
*
* @param rowPrefix
* prefix of rows to cover
*/
public static Range prefix(Text rowPrefix) {
Text fp = followingPrefix(rowPrefix);
return new Range(new Key(rowPrefix), true, fp == null ? null : new Key(fp), false);
}
代码示例来源:origin: apache/accumulo
@Override
protected Key newValue() throws IOException {
Key key = new Key();
key.readFields(dis);
return key;
}
}
代码示例来源:origin: apache/accumulo
SampleEntry(Key key, Value val) {
this.key = new Key(key);
this.val = new Value(val);
}
}
代码示例来源:origin: apache/accumulo
@Override
protected Key buildKey(Text partition, Text term, Text docID) {
Text colq = new Text(term);
colq.append(nullByte, 0, 1);
colq.append(docID.getBytes(), 0, docID.getLength());
colq.append(nullByte, 0, 1);
return new Key(partition, indexColf, colq);
}
代码示例来源:origin: apache/accumulo
public SequenceFileIterator(SequenceFile.Reader reader, boolean readValue) throws IOException {
this.reader = reader;
this.readValue = readValue;
top_key = new Key();
if (readValue)
top_value = new Value();
next();
}
代码示例来源:origin: apache/accumulo
private void addKeyValue(Key k, Value v) {
if (dropEmptyColFams && k.getColumnFamilyData().equals(EMPTY)) {
return;
}
keys.add(new Key(k));
values.add(new Value(v));
}
代码示例来源:origin: apache/accumulo
/**
* Constructs an iterator over Values whose Keys are versions of the current topKey of the
* source SortedKeyValueIterator.
*
* @param source
* The {@code SortedKeyValueIterator<Key,Value>} from which to read data.
*/
public ValueIterator(SortedKeyValueIterator<Key,Value> source) {
this.source = source;
topKey = new Key(source.getTopKey());
hasNext = _hasNext();
}
代码示例来源:origin: apache/accumulo
/**
* Creates a range that covers an exact row and column family.
*
* @param row
* row row to cover
* @param cf
* column family to cover
*/
public static Range exact(Text row, Text cf) {
Key startKey = new Key(row, cf);
return new Range(startKey, true, startKey.followingKey(PartialKey.ROW_COLFAM), false);
}
代码示例来源:origin: apache/accumulo
private static Scanner getTabletLogScanner(ServerContext context, KeyExtent extent) {
Table.ID tableId = MetadataTable.ID;
if (extent.isMeta())
tableId = RootTable.ID;
Scanner scanner = new ScannerImpl(context, tableId, Authorizations.EMPTY);
scanner.fetchColumnFamily(LogColumnFamily.NAME);
Text start = extent.getMetadataEntry();
Key endKey = new Key(start, LogColumnFamily.NAME);
endKey = endKey.followingKey(PartialKey.ROW_COLFAM);
scanner.setRange(new Range(new Key(start), endKey));
return scanner;
}
代码示例来源:origin: apache/accumulo
private void addUnfinishedRange(LookupResult lookupResult, Range range, Key key,
boolean inclusiveStartKey) {
if (range.getEndKey() == null || key.compareTo(range.getEndKey()) < 0) {
Range nlur = new Range(new Key(key), inclusiveStartKey, range.getEndKey(),
range.isEndKeyInclusive());
lookupResult.unfinishedRanges.add(nlur);
}
}
代码示例来源:origin: apache/accumulo
@Override
public Entry<Key,Value> next() {
try {
Entry<Key,Value> result = new KeyValue(new Key(inner.getTopKey()),
new Value(inner.getTopValue()).get());
inner.next();
return result;
} catch (IOException ex) {
throw new NoSuchElementException();
}
}
代码示例来源:origin: apache/accumulo
TreeMap<Key,Value> consume(SortedKeyValueIterator<Key,Value> skvi) throws IOException {
TreeMap<Key,Value> data = new TreeMap<>();
while (skvi.hasTop()) {
// Make sure to copy the K-V
data.put(new Key(skvi.getTopKey()), new Value(skvi.getTopValue()));
skvi.next();
}
return data;
}
代码示例来源:origin: apache/accumulo
@Override
protected FileSKVIterator openReader(FileOptions options) throws IOException {
FileSKVIterator iter = new RangeIterator(new MapFileIterator(options.getTableConfiguration(),
options.getFileSystem(), options.getFilename(), options.getConfiguration()));
if (options.isSeekToBeginning()) {
iter.seek(new Range(new Key(), null), new ArrayList<>(), false);
}
return iter;
}
代码示例来源:origin: apache/accumulo
private void consumeRow(ByteSequence row) throws IOException {
// try reading a few and if still not to next row, then seek
int count = 0;
while (source.hasTop() && source.getTopKey().getRowData().equals(row)) {
source.next();
count++;
if (count >= 10) {
Key nextRowStart = new Key(new Text(row.toArray())).followingKey(PartialKey.ROW);
reseek(nextRowStart);
count = 0;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!