private Pair<FilterPredicate, Set<Path>> addPrimitiveFilter(final Predicate filterFunction,
final String selection,
final String group) throws SerialisationException {
if (filterFunction instanceof IsEqual) {
return addIsEqualFilter(selection, schemaUtils.getConverter(group).gafferObjectToParquetObjects(selection, ((IsEqual) filterFunction).getControlValue()), group, false);
} else if (filterFunction instanceof IsLessThan) {
if (((IsLessThan) filterFunction).getOrEqualTo()) {
return addIsLessThanOrEqualToFilter(selection, schemaUtils.getConverter(group).gafferObjectToParquetObjects(selection, ((IsLessThan) filterFunction).getControlValue()), group);
} else {
return addIsLessThanFilter(selection, schemaUtils.getConverter(group).gafferObjectToParquetObjects(selection, ((IsLessThan) filterFunction).getControlValue()), group);
}
} else if (filterFunction instanceof IsMoreThan) {
if (((IsMoreThan) filterFunction).getOrEqualTo()) {
return addIsMoreThanOrEqualToFilter(selection, schemaUtils.getConverter(group).gafferObjectToParquetObjects(selection, ((IsMoreThan) filterFunction).getControlValue()), group);
} else {
return addIsMoreThanFilter(selection, schemaUtils.getConverter(group).gafferObjectToParquetObjects(selection, ((IsMoreThan) filterFunction).getControlValue()), group);
}
} else if (filterFunction instanceof IsTrue) {
return new Pair<>(eq(booleanColumn(selection), Boolean.TRUE), getAllPathsForColumn(group));
} else if (filterFunction instanceof IsFalse) {
return new Pair<>(eq(booleanColumn(selection), Boolean.FALSE), getAllPathsForColumn(group));
} else {
LOGGER.warn(filterFunction.getClass().getCanonicalName() +
" is not a natively supported filter by the Parquet store, therefore execution will take longer to perform this filter.");
return null;
}
}