MCPcopy Create free account
hub / github.com/apache/fluss / And

Class And

fluss-common/src/main/java/org/apache/fluss/predicate/And.java:31–82  ·  view source on GitHub ↗

A CompoundPredicate.Function to eval and.

Source from the content-addressed store, hash-verified

29
30/** A {@link CompoundPredicate.Function} to eval and. */
31public class And extends CompoundPredicate.Function {
32
33 private static final long serialVersionUID = -2977938814804928712L;
34
35 public static final And INSTANCE = new And();
36
37 private And() {}
38
39 @Override
40 public boolean test(InternalRow row, List<Predicate> children) {
41 for (Predicate child : children) {
42 if (!child.test(row)) {
43 return false;
44 }
45 }
46 return true;
47 }
48
49 @Override
50 public boolean test(
51 long rowCount,
52 InternalRow minValues,
53 InternalRow maxValues,
54 Long[] nullCounts,
55 List<Predicate> children) {
56 for (Predicate child : children) {
57 if (!child.test(rowCount, minValues, maxValues, nullCounts)) {
58 return false;
59 }
60 }
61 return true;
62 }
63
64 @Override
65 public Optional<Predicate> negate(List<Predicate> children) {
66 List<Predicate> negatedChildren = new ArrayList<>();
67 for (Predicate child : children) {
68 Optional<Predicate> negatedChild = child.negate();
69 if (negatedChild.isPresent()) {
70 negatedChildren.add(negatedChild.get());
71 } else {
72 return Optional.empty();
73 }
74 }
75 return Optional.of(new CompoundPredicate(Or.INSTANCE, negatedChildren));
76 }
77
78 @Override
79 public <T> T visit(FunctionVisitor<T> visitor, List<T> children) {
80 return visitor.visitAnd(children);
81 }
82}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected