标签:create 结构 heap this files 高效 生成 null sse
if (memOnly == false && ((StoreFileScanner) kvs).shouldSeek(scan, columns)) { scanners.add(kvs); }
if (!scan.isGetScan()) { return true; } byte[] row = scan.getStartRow(); switch (this.bloomFilterType) { case ROW: return passesBloomFilter(row, 0, row.length, null, 0, 0); case ROWCOL: if (columns != null && columns.size() == 1) { byte[] column = columns.first(); return passesBloomFilter(row, 0, row.length, column, 0, column.length); } // For multi-column queries the Bloom filter is checked from the // seekExact operation. return true; default: return true; }
// Seek all scanners to the start of the Row (or if the exact matching row // key does not exist, then to the start of the next matching Row). if (matcher.isExactColumnQuery()) { for (KeyValueScanner scanner : scanners) scanner.seekExactly(matcher.getStartKey(), false); } else { for (KeyValueScanner scanner : scanners) scanner.seek(matcher.getStartKey()); }
public boolean seekExactly(KeyValue kv, boolean forward) throws IOException { if (reader.getBloomFilterType() != StoreFile.BloomType.ROWCOL || kv.getRowLength() == 0 || kv.getQualifierLength() == 0) { return forward ? reseek(kv) : seek(kv); } boolean isInBloom = reader.passesBloomFilter(kv.getBuffer(), kv.getRowOffset(), kv.getRowLength(), kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength()); if (isInBloom) { // This row/column might be in this store file. Do a normal seek. return forward ? reseek(kv) : seek(kv); } // Create a fake key/value, so that this scanner only bubbles up to the top // of the KeyValueHeap in StoreScanner after we scanned this row/column in // all other store files. The query matcher will then just skip this fake // key/value and the store scanner will progress to the next column. cur = kv.createLastOnRowCol(); return true; }
由于Bloom Filter是须要事先知道过滤项的。对于顺序scan是没有事先办法知道rowkey的。
而get是指明了rowkey所以能够用Bloom Filter,scan指明column同理。
标签:create 结构 heap this files 高效 生成 null sse
原文地址:http://www.cnblogs.com/yutingliuyl/p/6812531.html