org.apache.hadoop.hbase.filter.FilterBase Java Examples
The following examples show how to use
org.apache.hadoop.hbase.filter.FilterBase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestHStore.java From hbase with Apache License 2.0 | 6 votes |
@Test public void testFlushBeforeCompletingScanWoFilter() throws IOException, InterruptedException { final AtomicBoolean timeToGoNextRow = new AtomicBoolean(false); final int expectedSize = 3; testFlushBeforeCompletingScan(new MyListHook() { @Override public void hook(int currentSize) { if (currentSize == expectedSize - 1) { try { flushStore(store, id++); timeToGoNextRow.set(true); } catch (IOException e) { throw new RuntimeException(e); } } } }, new FilterBase() { @Override public Filter.ReturnCode filterCell(final Cell c) throws IOException { return ReturnCode.INCLUDE; } }, expectedSize); }
Example #2
Source File: TestHStore.java From hbase with Apache License 2.0 | 5 votes |
@Test public void testFlushBeforeCompletingScanWithFilter() throws IOException, InterruptedException { final AtomicBoolean timeToGoNextRow = new AtomicBoolean(false); final int expectedSize = 2; testFlushBeforeCompletingScan(new MyListHook() { @Override public void hook(int currentSize) { if (currentSize == expectedSize - 1) { try { flushStore(store, id++); timeToGoNextRow.set(true); } catch (IOException e) { throw new RuntimeException(e); } } } }, new FilterBase() { @Override public Filter.ReturnCode filterCell(final Cell c) throws IOException { if (timeToGoNextRow.get()) { timeToGoNextRow.set(false); return ReturnCode.NEXT_ROW; } else { return ReturnCode.INCLUDE; } } }, expectedSize); }
Example #3
Source File: TestHStore.java From hbase with Apache License 2.0 | 5 votes |
@Test public void testFlushBeforeCompletingScanWithFilterHint() throws IOException, InterruptedException { final AtomicBoolean timeToGetHint = new AtomicBoolean(false); final int expectedSize = 2; testFlushBeforeCompletingScan(new MyListHook() { @Override public void hook(int currentSize) { if (currentSize == expectedSize - 1) { try { flushStore(store, id++); timeToGetHint.set(true); } catch (IOException e) { throw new RuntimeException(e); } } } }, new FilterBase() { @Override public Filter.ReturnCode filterCell(final Cell c) throws IOException { if (timeToGetHint.get()) { timeToGetHint.set(false); return Filter.ReturnCode.SEEK_NEXT_USING_HINT; } else { return Filter.ReturnCode.INCLUDE; } } @Override public Cell getNextCellHint(Cell currentCell) throws IOException { return currentCell; } }, expectedSize); }
Example #4
Source File: TestImportExport.java From hbase with Apache License 2.0 | 5 votes |
/** * Test addFilterAndArguments method of Import This method set couple * parameters into Configuration */ @Test public void testAddFilterAndArguments() throws IOException { Configuration configuration = new Configuration(); List<String> args = new ArrayList<>(); args.add("param1"); args.add("param2"); Import.addFilterAndArguments(configuration, FilterBase.class, args); assertEquals("org.apache.hadoop.hbase.filter.FilterBase", configuration.get(Import.FILTER_CLASS_CONF_KEY)); assertEquals("param1,param2", configuration.get(Import.FILTER_ARGS_CONF_KEY)); }
Example #5
Source File: TransactionalRegion.java From hbase-secondary-index with GNU General Public License v3.0 | 4 votes |
private Scan wrapWithDeleteFilter(final Scan scan, final TransactionState state) { FilterBase deleteFilter = new FilterBase() { private boolean rowFiltered = false; @Override public void reset() { rowFiltered = false; } @Override public boolean hasFilterRow() { return true; } @Override public void filterRow(final List<KeyValue> kvs) { state.applyDeletes(kvs, scan.getTimeRange().getMin(), scan.getTimeRange().getMax()); rowFiltered = kvs.isEmpty(); } @Override public boolean filterRow() { return rowFiltered; } @Override public void write(final DataOutput out) throws IOException { // does nothing } @Override public void readFields(final DataInput in) throws IOException { // does nothing } }; if (scan.getFilter() == null) { scan.setFilter(deleteFilter); return scan; } FilterList wrappedFilter = new FilterList(Arrays.asList(deleteFilter, scan.getFilter())); scan.setFilter(wrappedFilter); return scan; }