Search in sources :

Example 6 with Not

use of uk.gov.gchq.koryphe.impl.predicate.Not in project Gaffer by gchq.

the class JavaPredicateToParquetPredicate method getParquetPredicate.

public FilterPredicate getParquetPredicate() throws SerialisationException {
    FilterPredicate filterResult;
    if (javaPredicate instanceof AgeOff) {
        filterResult = getAgeOffPredicate((AgeOff) javaPredicate, selection, group, schemaUtils);
    } else if (javaPredicate instanceof And) {
        final And and = (And) javaPredicate;
        filterResult = getAndFilter((List<Predicate>) and.getComponents(), selection, group, schemaUtils);
    } else if (javaPredicate instanceof Or) {
        final Or or = (Or) javaPredicate;
        filterResult = getOrFilter((List<Predicate>) or.getComponents(), selection, group, schemaUtils);
    } else if (javaPredicate instanceof Not) {
        final Not not = (Not) javaPredicate;
        final JavaPredicateToParquetPredicate predicateConverter = new JavaPredicateToParquetPredicate(schemaUtils, not.getPredicate(), selection, group);
        final FilterPredicate parquetPredicate = predicateConverter.getParquetPredicate();
        if (!predicateConverter.fullyApplied) {
            fullyApplied = false;
        }
        filterResult = FilterPredicateUtils.not(parquetPredicate);
    } else {
        filterResult = getPrimitiveFilter(javaPredicate, selection[0], group, schemaUtils);
    }
    return filterResult;
}
Also used : Not(uk.gov.gchq.koryphe.impl.predicate.Not) Or(uk.gov.gchq.koryphe.impl.predicate.Or) AgeOff(uk.gov.gchq.koryphe.impl.predicate.AgeOff) And(uk.gov.gchq.koryphe.impl.predicate.And) List(java.util.List) FilterPredicate(org.apache.parquet.filter2.predicate.FilterPredicate) FilterPredicate(org.apache.parquet.filter2.predicate.FilterPredicate) TupleAdaptedPredicate(uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate) Predicate(java.util.function.Predicate)

Aggregations

Not (uk.gov.gchq.koryphe.impl.predicate.Not)6 Test (org.junit.jupiter.api.Test)3 IsEqual (uk.gov.gchq.koryphe.impl.predicate.IsEqual)3 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 ValidationResult (uk.gov.gchq.koryphe.ValidationResult)2 IsMoreThan (uk.gov.gchq.koryphe.impl.predicate.IsMoreThan)2 List (java.util.List)1 Predicate (java.util.function.Predicate)1 FilterPredicate (org.apache.parquet.filter2.predicate.FilterPredicate)1 JSONSerialisationTest (uk.gov.gchq.gaffer.JSONSerialisationTest)1 Entity (uk.gov.gchq.gaffer.data.element.Entity)1 AgeOff (uk.gov.gchq.koryphe.impl.predicate.AgeOff)1 And (uk.gov.gchq.koryphe.impl.predicate.And)1 AreEqual (uk.gov.gchq.koryphe.impl.predicate.AreEqual)1 Exists (uk.gov.gchq.koryphe.impl.predicate.Exists)1 Or (uk.gov.gchq.koryphe.impl.predicate.Or)1 TupleAdaptedPredicate (uk.gov.gchq.koryphe.tuple.predicate.TupleAdaptedPredicate)1