本文整理汇总了Java中org.apache.hadoop.hbase.io.encoding.DataBlockEncoding.PREFIX_TREE属性的典型用法代码示例。如果您正苦于以下问题:Java DataBlockEncoding.PREFIX_TREE属性的具体用法?Java DataBlockEncoding.PREFIX_TREE怎么用?Java DataBlockEncoding.PREFIX_TREE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.io.encoding.DataBlockEncoding
的用法示例。
在下文中一共展示了DataBlockEncoding.PREFIX_TREE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finishFileInfo
protected void finishFileInfo() throws IOException {
super.finishFileInfo();
if (hFileContext.getDataBlockEncoding() == DataBlockEncoding.PREFIX_TREE) {
// In case of Prefix Tree encoding, we always write tags information into HFiles even if all
// KVs are having no tags.
fileInfo.append(FileInfo.MAX_TAGS_LEN, Bytes.toBytes(this.maxTagsLength), false);
} else if (hFileContext.isIncludesTags()) {
// When tags are not being written in this file, MAX_TAGS_LEN is excluded
// from the FileInfo
fileInfo.append(FileInfo.MAX_TAGS_LEN, Bytes.toBytes(this.maxTagsLength), false);
boolean tagsCompressed = (hFileContext.getDataBlockEncoding() != DataBlockEncoding.NONE)
&& hFileContext.isCompressTags();
fileInfo.append(FileInfo.TAGS_COMPRESSED, Bytes.toBytes(tagsCompressed), false);
}
}
示例2: testSeekToInternals
protected void testSeekToInternals(TagUsage tagUsage) throws IOException {
Path p = makeNewFile(tagUsage);
FileSystem fs = TEST_UTIL.getTestFileSystem();
Configuration conf = TEST_UTIL.getConfiguration();
HFile.Reader reader = HFile.createReader(fs, p, new CacheConfig(conf), conf);
reader.loadFileInfo();
assertEquals(2, reader.getDataBlockIndexReader().getRootBlockCount());
HFileScanner scanner = reader.getScanner(false, true);
// lies before the start of the file.
assertEquals(-1, scanner.seekTo(toKV("a", tagUsage)));
assertEquals(1, scanner.seekTo(toKV("d", tagUsage)));
assertEquals("c", toRowStr(scanner.getKeyValue()));
// Across a block boundary now.
// 'h' does not exist so we will get a '1' back for not found.
assertEquals(0, scanner.seekTo(toKV("i", tagUsage)));
assertEquals("i", toRowStr(scanner.getKeyValue()));
assertEquals(1, scanner.seekTo(toKV("l", tagUsage)));
if (encoding == DataBlockEncoding.PREFIX_TREE) {
// TODO : Fix this
assertEquals(null, scanner.getKeyValue());
} else {
assertEquals("k", toRowStr(scanner.getKeyValue()));
}
reader.close();
deleteTestDir(fs);
}
示例3: newDataBlockEncodingContext
@Override
public HFileBlockEncodingContext newDataBlockEncodingContext(
DataBlockEncoding encoding, byte[] header, HFileContext meta) {
if(DataBlockEncoding.PREFIX_TREE != encoding){
//i'm not sure why encoding is in the interface. Each encoder implementation should probably
//know it's encoding type
throw new IllegalArgumentException("only DataBlockEncoding.PREFIX_TREE supported");
}
return new HFileBlockDefaultEncodingContext(encoding, header, meta);
}