/** * A way to filter based on the column family, column qualifier and/or the column value. Return * code is described below. This allows filters to filter only certain number of columns, then * terminate without matching ever column. * * If filterRowKey returns true, filterCell needs to be consistent with it. * * filterCell can assume that filterRowKey has already been called for the row. * * If your filter returns <code>ReturnCode.NEXT_ROW</code>, it should return * <code>ReturnCode.NEXT_ROW</code> until {@link #reset()} is called just in case the caller calls * for the next row. * * Concrete implementers can signal a failure condition in their code by throwing an * {@link IOException}. * * @param c the Cell in question * @return code as described below * @throws IOException in case an I/O or an filter specific failure needs to be signaled. * @see Filter.ReturnCode */ public ReturnCode filterCell(final Cell c) throws IOException{ return filterKeyValue(c); }
break; Filter.ReturnCode filterResult = filter.filterKeyValue(kv); if (filterResult == Filter.ReturnCode.INCLUDE) { nkvs.add(kv);
/** * A way to filter based on the column family, column qualifier and/or the column value. Return * code is described below. This allows filters to filter only certain number of columns, then * terminate without matching ever column. * * If filterRowKey returns true, filterCell needs to be consistent with it. * * filterCell can assume that filterRowKey has already been called for the row. * * If your filter returns <code>ReturnCode.NEXT_ROW</code>, it should return * <code>ReturnCode.NEXT_ROW</code> until {@link #reset()} is called just in case the caller calls * for the next row. * * Concrete implementers can signal a failure condition in their code by throwing an * {@link IOException}. * * @param c the Cell in question * @return code as described below * @throws IOException in case an I/O or an filter specific failure needs to be signaled. * @see Filter.ReturnCode */ public ReturnCode filterCell(final Cell c) throws IOException{ return filterKeyValue(c); }
private boolean seekToNextUnfilteredKeyValue() throws IOException { while (true) { KeyValue peeked = delegate.peek(); // no more key values, so we are done if (peeked == null) { return false; } // filter the peeked value to see if it should be served ReturnCode code = filter.filterKeyValue(peeked); switch (code) { // included, so we are done case INCLUDE: case INCLUDE_AND_NEXT_COL: return true; // not included, so we need to go to the next row case SKIP: case NEXT_COL: case NEXT_ROW: delegate.next(); break; // use a seek hint to find out where we should go case SEEK_NEXT_USING_HINT: delegate.seek(filter.getNextKeyHint(peeked)); } } }
private boolean seekToNextUnfilteredKeyValue() throws IOException { while (true) { Cell peeked = delegate.peek(); // no more key values, so we are done if (peeked == null) { return false; } // filter the peeked value to see if it should be served ReturnCode code = filter.filterKeyValue(peeked); switch (code) { // included, so we are done case INCLUDE: case INCLUDE_AND_NEXT_COL: return true; // not included, so we need to go to the next row case SKIP: case NEXT_COL: case NEXT_ROW: delegate.next(); break; // use a seek hint to find out where we should go case SEEK_NEXT_USING_HINT: Cell nextCellHint = filter.getNextCellHint(peeked); if(nextCellHint == KeyValue.LOWESTKEY) { delegate.next(); } else { delegate.seek(PhoenixKeyValueUtil.maybeCopyCell(nextCellHint)); } } } }
private void assertInclude(byte[] next, Filter f) throws IOException { Cell c = new KeyValue(next, ByteUtil.EMPTY_BYTE_ARRAY, ByteUtil.EMPTY_BYTE_ARRAY, 0, ByteUtil.EMPTY_BYTE_ARRAY); assertTrue(f.filterKeyValue(c) == ReturnCode.INCLUDE); assertFalse(f.filterAllRemaining()); }
continue; if (filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE) { nkvs.add(kv);
continue; Filter.ReturnCode filterResult = filter.filterKeyValue(kv); if (filterResult == Filter.ReturnCode.INCLUDE) { nkvs.add(kv);
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
@Override public ReturnCode filterKeyValue(Cell v) throws IOException { ReturnCode c = filter.filterKeyValue(v); changeFR(c != ReturnCode.INCLUDE); return c; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
public ReturnCode filterKeyValue(KeyValue v) { ReturnCode c = filter.filterKeyValue(v); changeFR(c != ReturnCode.INCLUDE); return c; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException { if (cellFilter != null) { ReturnCode subFilterCode = cellFilter.filterKeyValue(cell); return determineReturnCode(txFilterCode, subFilterCode); } return txFilterCode; }
private void assertSeekAndHint(byte[] next, Filter f, byte[] rowHint, boolean filterAll) throws IOException { Cell c = new KeyValue(next, ByteUtil.EMPTY_BYTE_ARRAY, ByteUtil.EMPTY_BYTE_ARRAY, 0, ByteUtil.EMPTY_BYTE_ARRAY); assertTrue(f.filterKeyValue(c) == ReturnCode.SEEK_NEXT_USING_HINT); Cell h = f.getNextCellHint(c); byte[] hintBytes = rowHint; assertTrue(Bytes.equals(hintBytes, 0, hintBytes.length, h.getRowArray(), h.getRowOffset(), h.getRowLength())); assertEquals(filterAll, f.filterAllRemaining()); }