@Override public boolean filterRowKey(Cell cell) throws IOException { if (filterAllRemaining()) return true; return this.filter.filterRowKey(cell); }
@Override public ReturnCode filterCell(final Cell c) throws IOException { ReturnCode rc = filter.filterCell(c); changeFR(rc != ReturnCode.INCLUDE); return rc; }
/** * @param o the other filter to compare with * @return true if and only if the fields of the filter that are serialized * are equal to the corresponding fields in other. Used for testing. */ @Override boolean areSerializedFieldsEqual(Filter o) { if (o == this) return true; if (!(o instanceof WhileMatchFilter)) return false; WhileMatchFilter other = (WhileMatchFilter)o; return getFilter().areSerializedFieldsEqual(other.getFilter()); }
public static Filter getFilter(SliceQuery query) { byte[] colStartBytes = query.getSliceEnd().length() > 0 ? query.getSliceStart().as(StaticBuffer.ARRAY_FACTORY) : null; byte[] colEndBytes = query.getSliceEnd().length() > 0 ? query.getSliceEnd().as(StaticBuffer.ARRAY_FACTORY) : null; Filter filter = new ColumnRangeFilter(colStartBytes, true, colEndBytes, false); if (query.hasLimit()) { filter = new FilterList(FilterList.Operator.MUST_PASS_ALL, filter, new ColumnPaginationFilter(query.getLimit(), 0)); } logger.debug("Generated HBase Filter {}", filter); return filter; }
private Filter regexFilterNew() { return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOperator.EQUAL, new RegexStringComparator(QUICK_REGEX)); }
private Filter substrFilterNew() { return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOperator.EQUAL, new SubstringComparator(QUICK_SUBSTR)); }
private Filter nullFilterNew() { return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOperator.NOT_EQUAL, new NullComparator()); }
@Override public boolean filterRowKey(Cell cell) throws IOException { if (filterAllRemaining()) return true; boolean value = filter.filterRowKey(cell); changeFAR(value); return value; }
@Override public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException { boolean value = filter.filterRowKey(buffer, offset, length); changeFAR(value); return value; }
@Override public boolean filterAllRemaining() throws IOException { if (isEmpty()) { return super.filterAllRemaining(); } for (int i = 0, n = filters.size(); i < n; i++) { if (filters.get(i).filterAllRemaining()) { return true; } } return false; }
@Override public boolean filterAllRemaining() throws IOException { if (isEmpty()) { return super.filterAllRemaining(); } for (int i = 0, n = filters.size(); i < n; i++) { if (!filters.get(i).filterAllRemaining()) { return false; } } return true; }
@Test public void testSerialization() throws Exception { // Decompose mainFilter to bytes. byte[] buffer = mainFilter.toByteArray(); // Recompose filter. Filter newFilter = PrefixFilter.parseFrom(buffer); // Ensure the serialization preserved the filter by running all test. prefixRowTests(newFilter); }
/** * Tests serialization * @throws Exception */ @Test public void testSerialization() throws Exception { // Decompose mainFilter to bytes. byte[] buffer = mainFilter.toByteArray(); // Recompose mainFilter. Filter newFilter = InclusiveStopFilter.parseFrom(buffer); // Ensure the serialization preserved the filter by running a full test. stopRowTests(newFilter); }
private Filter serializationTest(Filter filter) throws Exception { // Decompose filter to bytes. byte[] buffer = filter.toByteArray(); // Recompose filter. Filter newFilter = SingleColumnValueFilter.parseFrom(buffer); return newFilter; }
/** * @param o the other filter to compare with * @return true if and only if the fields of the filter that are serialized * are equal to the corresponding fields in other. Used for testing. */ @Override boolean areSerializedFieldsEqual(Filter o) { if (o == this) return true; if (!(o instanceof SkipFilter)) return false; SkipFilter other = (SkipFilter)o; return getFilter().areSerializedFieldsEqual(other.getFilter()); }
/** * @param other * @return true if and only if the fields of the comparator that are serialized * are equal to the corresponding fields in other. Used for testing. */ @Override boolean areSerializedFieldsEqual(ByteArrayComparable other) { if (other == this) return true; if (!(other instanceof BitComparator)) return false; BitComparator comparator = (BitComparator)other; return super.areSerializedFieldsEqual(other) && this.getOperator().equals(comparator.getOperator()); }
@Override public ReturnCode filterCell(final Cell c) throws IOException { ReturnCode code = filter.filterCell(c); changeFAR(code != ReturnCode.INCLUDE); return code; }
private Cell createKeyOnlyCell(Cell c) { if (c instanceof ByteBufferExtendedCell) { return new KeyOnlyByteBufferExtendedCell((ByteBufferExtendedCell) c, lenAsVal); } else { return new KeyOnlyCell(c, lenAsVal); } }
@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); }