private boolean isFilterDoneInternal() throws IOException { return this.filter != null && this.filter.filterAllRemaining(); }
/** * This function is to maintain backward compatibility for 0.94 filters. HBASE-6429 combines * both filterRow & filterRow({@code List<KeyValue> kvs}) functions. While 0.94 code or older, * it may not implement hasFilterRow as HBase-6429 expects because 0.94 hasFilterRow() only * returns true when filterRow({@code List<KeyValue> kvs}) is overridden not the filterRow(). * Therefore, the filterRow() will be skipped. */ private boolean filterRow() throws IOException { // when hasFilterRow returns true, filter.filterRow() will be called automatically inside // filterRowCells(List<Cell> kvs) so we skip that scenario here. return filter != null && (!filter.hasFilterRow()) && filter.filterRow(); }
@Override public void filterRowCells(List<Cell> kvs) throws IOException { filterRowCellsWithRet(kvs); }
boolean hasFilterRow = this.filter != null && this.filter.hasFilterRow(); filter.filterRowCells(results); ret = filter.filterRowCellsWithRet(results);
@Test public void testFilterWrapper() throws Exception { FilterWrapper filterWrapper = new FilterWrapper( new ColumnRangeFilter(Bytes.toBytes("e"), false, Bytes.toBytes("f"), true)); assertTrue(filterWrapper.areSerializedFieldsEqual( ProtobufUtil.toFilter(ProtobufUtil.toFilter(filterWrapper)))); }
/** * @param pbBytes A pb serialized {@link FilterWrapper} instance * @return An instance of {@link FilterWrapper} made from <code>bytes</code> * @throws org.apache.hadoop.hbase.exceptions.DeserializationException * @see #toByteArray */ public static FilterWrapper parseFrom(final byte [] pbBytes) throws DeserializationException { FilterProtos.FilterWrapper proto; try { proto = FilterProtos.FilterWrapper.parseFrom(pbBytes); } catch (InvalidProtocolBufferException e) { throw new DeserializationException(e); } try { return new FilterWrapper(ProtobufUtil.toFilter(proto.getFilter())); } catch (IOException ioe) { throw new DeserializationException(ioe); } }
this.maxResultSize = scan.getMaxResultSize(); if (scan.hasFilter()) { this.filter = new FilterWrapper(scan.getFilter()); } else { this.filter = null; || this.filter.isFamilyEssential(entry.getKey())) { scanners.add(scanner); } else {
/** * Reset both the filter and the old filter. * * @throws IOException in case a filter raises an I/O exception. */ protected void resetFilters() throws IOException { if (filter != null) { filter.reset(); } }
private boolean filterRowKey(Cell current) throws IOException { return filter != null && filter.filterRowKey(current); }
protected void initializeScanners(Scan scan, List<KeyValueScanner> additionalScanners) throws IOException { // Here we separate all scanners into two lists - scanner that provide data required // by the filter to operate (scanners list) and all others (joinedScanners list). List<KeyValueScanner> scanners = new ArrayList<>(scan.getFamilyMap().size()); List<KeyValueScanner> joinedScanners = new ArrayList<>(scan.getFamilyMap().size()); // Store all already instantiated scanners for exception handling List<KeyValueScanner> instantiatedScanners = new ArrayList<>(); // handle additionalScanners if (additionalScanners != null && !additionalScanners.isEmpty()) { scanners.addAll(additionalScanners); instantiatedScanners.addAll(additionalScanners); } try { for (Map.Entry<byte[], NavigableSet<byte[]>> entry : scan.getFamilyMap().entrySet()) { HStore store = stores.get(entry.getKey()); KeyValueScanner scanner = store.getScanner(scan, entry.getValue(), this.readPt); instantiatedScanners.add(scanner); if (this.filter == null || !scan.doLoadColumnFamiliesOnDemand() || this.filter.isFamilyEssential(entry.getKey())) { scanners.add(scanner); } else { joinedScanners.add(scanner); } } initializeKVHeap(scanners, joinedScanners, region); } catch (Throwable t) { throw handleException(instantiatedScanners, t); } }
boolean hasFilterRow = this.filter != null && this.filter.hasFilterRow(); filter.filterRowCells(results); ret = filter.filterRowCellsWithRet(results);
@Test public void testFilterWrapper() throws Exception { FilterWrapper filterWrapper = new FilterWrapper( new ColumnRangeFilter(Bytes.toBytes("e"), false, Bytes.toBytes("f"), true)); assertTrue(filterWrapper.areSerializedFieldsEqual( ProtobufUtil.toFilter(ProtobufUtil.toFilter(filterWrapper)))); }
this.maxResultSize = scan.getMaxResultSize(); if (scan.hasFilter()) { this.filter = new FilterWrapper(scan.getFilter()); } else { this.filter = null;
/** * Reset both the filter and the old filter. * * @throws IOException in case a filter raises an I/O exception. */ protected void resetFilters() throws IOException { if (filter != null) { filter.reset(); } }
private boolean filterRowKey(byte[] row, int offset, short length) throws IOException { return filter != null && filter.filterRowKey(row, offset, length); }
/** * This function is to maintain backward compatibility for 0.94 filters. HBASE-6429 combines * both filterRow & filterRow(List<KeyValue> kvs) functions. While 0.94 code or older, it may * not implement hasFilterRow as HBase-6429 expects because 0.94 hasFilterRow() only returns * true when filterRow(List<KeyValue> kvs) is overridden not the filterRow(). Therefore, the * filterRow() will be skipped. */ private boolean filterRow() throws IOException { // when hasFilterRow returns true, filter.filterRow() will be called automatically inside // filterRowCells(List<Cell> kvs) so we skip that scenario here. return filter != null && (!filter.hasFilterRow()) && filter.filterRow(); }
/** * @param pbBytes A pb serialized {@link FilterWrapper} instance * @return An instance of {@link FilterWrapper} made from <code>bytes</code> * @throws org.apache.hadoop.hbase.exceptions.DeserializationException * @see #toByteArray */ public static FilterWrapper parseFrom(final byte [] pbBytes) throws DeserializationException { FilterProtos.FilterWrapper proto; try { proto = FilterProtos.FilterWrapper.parseFrom(pbBytes); } catch (InvalidProtocolBufferException e) { throw new DeserializationException(e); } try { return new FilterWrapper(ProtobufUtil.toFilter(proto.getFilter())); } catch (IOException ioe) { throw new DeserializationException(ioe); } }
@Override public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException { // No call to this. if (filterAllRemaining()) return true; return this.filter.filterRowKey(buffer, offset, length); }
@Override public void filterRowCells(List<Cell> kvs) throws IOException { filterRowCellsWithRet(kvs); }
@Override public boolean filterRowKey(Cell cell) throws IOException { if (filterAllRemaining()) return true; return this.filter.filterRowKey(cell); }