/** * A method for checking Bloom filters. Called directly from * StoreFileScanner in case of a multi-column query. * * @return True if passes */ private boolean passesGeneralRowBloomFilter(byte[] row, int rowOffset, int rowLen) { BloomFilter bloomFilter = this.generalBloomFilter; if (bloomFilter == null) { return true; } // Used in ROW bloom byte[] key = null; if (rowOffset != 0 || rowLen != row.length) { throw new AssertionError( "For row-only Bloom filters the row must occupy the whole array"); } key = row; return checkGeneralBloomFilter(key, null, bloomFilter); }
/** * A method for checking Bloom filters. Called directly from * StoreFileScanner in case of a multi-column query. * * @param cell * the cell to check if present in BloomFilter * @return True if passes */ public boolean passesGeneralRowColBloomFilter(Cell cell) { BloomFilter bloomFilter = this.generalBloomFilter; if (bloomFilter == null) { return true; } // Used in ROW_COL bloom Cell kvKey = null; // Already if the incoming key is a fake rowcol key then use it as it is if (cell.getTypeByte() == KeyValue.Type.Maximum.getCode() && cell.getFamilyLength() == 0) { kvKey = cell; } else { kvKey = PrivateCellUtil.createFirstOnRowCol(cell); } return checkGeneralBloomFilter(null, kvKey, bloomFilter); }
/** * A method for checking Bloom filters. Called directly from * StoreFileScanner in case of a multi-column query. * * @return True if passes */ private boolean passesGeneralRowPrefixBloomFilter(Scan scan) { BloomFilter bloomFilter = this.generalBloomFilter; if (bloomFilter == null) { return true; } byte[] row = scan.getStartRow(); byte[] rowPrefix; if (scan.isGetScan()) { rowPrefix = Bytes.copy(row, 0, Math.min(prefixLength, row.length)); } else { // For non-get scans // Find out the common prefix of startRow and stopRow. int commonLength = Bytes.findCommonPrefix(scan.getStartRow(), scan.getStopRow(), scan.getStartRow().length, scan.getStopRow().length, 0, 0); // startRow and stopRow don't have the common prefix. // Or the common prefix length is less than prefixLength if (commonLength <= 0 || commonLength < prefixLength) { return true; } rowPrefix = Bytes.copy(row, 0, prefixLength); } return checkGeneralBloomFilter(rowPrefix, null, bloomFilter); }
return checkGeneralBloomFilter(rowPrefix, null, bloomFilter);