/** * @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()); }
this.filters = new ArrayList<>(); this.filters.add( new FilterModel(((WhileMatchFilter)filter).getFilter())); break; default:
@Test public void testWhileFilter() throws IOException { String filterString = " WHILE RowFilter ( !=, 'binary:row1')"; WhileMatchFilter whileMatchFilter = doTestFilter(filterString, WhileMatchFilter.class); assertTrue(whileMatchFilter.getFilter() instanceof RowFilter); RowFilter rowFilter = (RowFilter) whileMatchFilter.getFilter(); assertEquals(CompareOperator.NOT_EQUAL, rowFilter.getCompareOperator()); assertTrue(rowFilter.getComparator() instanceof BinaryComparator); BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator(); assertEquals("row1", new String(binaryComparator.getValue(), StandardCharsets.UTF_8)); }
/** * @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()); }
/** * @param other * @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. */ boolean areSerializedFieldsEqual(Filter o) { if (o == this) return true; if (!(o instanceof WhileMatchFilter)) return false; WhileMatchFilter other = (WhileMatchFilter)o; return getFilter().areSerializedFieldsEqual(other.getFilter()); }
/** * @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()); }
/** * Wraps an existing {@link WhileMatchFilter} filter into a {@link ModelAwareWhileMatchFilter}. */ public static ModelAwareWhileMatchFilter wrap(WhileMatchFilter filter) { return new ModelAwareWhileMatchFilter(filter.getFilter()); }
/** {@inheritDoc} */ @Override public FilterSupportStatus isFilterSupported( FilterAdapterContext context, WhileMatchFilter filter) { // checks if wrapped filter is supported. List<FilterSupportStatus> unsupportedStatuses = new ArrayList<>(); subFilterAdapter.collectUnsupportedStatuses(context, filter.getFilter(), unsupportedStatuses); if (!unsupportedStatuses.isEmpty()) { return FilterSupportStatus.newCompositeNotSupported(unsupportedStatuses); } // Checks if this filter is in an interleave. if (inInterleave(context.getScan().getFilter(), filter)) { return FilterSupportStatus.newNotSupported( "A WhileMatchFilter cannot be in a FilterList with MUST_PASS_ONE operation."); } return FilterSupportStatus.SUPPORTED; }
/** {@inheritDoc} */ @Override public FilterSupportStatus isFilterSupported( FilterAdapterContext context, WhileMatchFilter filter) { // checks if wrapped filter is supported. List<FilterSupportStatus> unsupportedStatuses = new ArrayList<>(); subFilterAdapter.collectUnsupportedStatuses(context, filter.getFilter(), unsupportedStatuses); if (!unsupportedStatuses.isEmpty()) { return FilterSupportStatus.newCompositeNotSupported(unsupportedStatuses); } // Checks if this filter is in an interleave. if (inInterleave(context.getScan().getFilter(), filter)) { return FilterSupportStatus.newNotSupported( "A WhileMatchFilter cannot be in a FilterList with MUST_PASS_ONE operation."); } return FilterSupportStatus.SUPPORTED; }
this.filters = new ArrayList<>(); this.filters.add( new FilterModel(((WhileMatchFilter)filter).getFilter())); break; default:
context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter());
context.getNumberOfWhileMatchFilters() == 0, "More than one WhileMatchFilter is not supported."); checkNotNull(filter.getFilter(), "The wrapped filter for a WhileMatchFilter cannot be null."); Optional<Filters.Filter> wrappedFilter = subFilterAdapter.adaptFilter(context, filter.getFilter()); checkArgument( wrappedFilter.isPresent(), "Unable to adapted the wrapped filter: " + filter.getFilter());
@Test public void testWhileFilter() throws IOException { String filterString = " WHILE RowFilter ( !=, 'binary:row1')"; WhileMatchFilter whileMatchFilter = doTestFilter(filterString, WhileMatchFilter.class); assertTrue(whileMatchFilter.getFilter() instanceof RowFilter); RowFilter rowFilter = (RowFilter) whileMatchFilter.getFilter(); assertEquals(CompareOperator.NOT_EQUAL, rowFilter.getCompareOperator()); assertTrue(rowFilter.getComparator() instanceof BinaryComparator); BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator(); assertEquals("row1", new String(binaryComparator.getValue(), StandardCharsets.UTF_8)); }
this.filters = new ArrayList<>(); this.filters.add( new FilterModel(((WhileMatchFilter)filter).getFilter())); break; default:
this.filters = new ArrayList<FilterModel>(); this.filters.add( new FilterModel(((WhileMatchFilter)filter).getFilter())); break; default: