/** * Add a Regex Equality Filter to the Scanner, Will Filter Results Not Equal to the Filter Value * * @param fieldName The name of the column you want to apply the filter on * @param filterValue The regular expression to use for comparison * @return ScannerBuilder */ public EntityScannerBuilder<E> addRegexMatchFilter(String fieldName, String regexString) { RegexEntityFilter regexEntityFilter = new RegexEntityFilter( entityMapper.getEntitySchema(), entityMapper.getEntitySerDe(), fieldName, regexString); filterList.add(regexEntityFilter.getFilter()); return this; }
/** * Only include rows which have an empty value for this field * * @param fieldName The field to check nullity * @return ScannerBuilder */ public EntityScannerBuilder<E> addIsNullFilter(String fieldName) { RegexEntityFilter regexEntityFilter = new RegexEntityFilter( entityMapper.getEntitySchema(), entityMapper.getEntitySerDe(), fieldName, ".+", false); filterList.add(regexEntityFilter.getFilter()); return this; }
/** * Add an Inequality Filter to the Scanner, Will Filter Results Not Equal to the Filter Value * * @param fieldName The name of the column you want to apply the filter on * @param filterValue The value for comparison * @return ScannerBuilder */ public EntityScannerBuilder<E> addNotEqualFilter(String fieldName, Object filterValue) { SingleFieldEntityFilter singleFieldEntityFilter = new SingleFieldEntityFilter( entityMapper.getEntitySchema(), entityMapper.getEntitySerDe(), fieldName, filterValue, CompareFilter.CompareOp.NOT_EQUAL); filterList.add(singleFieldEntityFilter.getFilter()); return this; }
/** * Only include rows which are missing this field, this was the only possible way to do it. * * @param fieldName The field which should be missing * @return ScannerBuilder */ public EntityScannerBuilder<E> addIsMissingFilter(String fieldName) { SingleFieldEntityFilter singleFieldEntityFilter = new SingleFieldEntityFilter( entityMapper.getEntitySchema(), entityMapper.getEntitySerDe(), fieldName, "++++NON_SHALL_PASS++++", CompareFilter.CompareOp.EQUAL); SingleColumnValueFilter filter = (SingleColumnValueFilter) singleFieldEntityFilter.getFilter(); filter.setFilterIfMissing(false); filterList.add(filter); return this; }