@Test public void testGetOrFilterOperator() { BaseFilterOperator filterOperator = FilterOperatorUtils.getOrFilterOperator(Collections.emptyList(), NUM_DOCS, null); assertTrue(filterOperator instanceof EmptyFilterOperator); filterOperator = FilterOperatorUtils.getOrFilterOperator(Collections.singletonList(EMPTY_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof EmptyFilterOperator); filterOperator = FilterOperatorUtils.getOrFilterOperator(Collections.singletonList(MATCH_ALL_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof MatchAllFilterOperator); filterOperator = FilterOperatorUtils.getOrFilterOperator(Collections.singletonList(REGULAR_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof TestFilterOperator); filterOperator = FilterOperatorUtils .getOrFilterOperator(Arrays.asList(EMPTY_FILTER_OPERATOR, MATCH_ALL_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof MatchAllFilterOperator); filterOperator = FilterOperatorUtils .getOrFilterOperator(Arrays.asList(EMPTY_FILTER_OPERATOR, REGULAR_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof TestFilterOperator); filterOperator = FilterOperatorUtils .getOrFilterOperator(Arrays.asList(MATCH_ALL_FILTER_OPERATOR, REGULAR_FILTER_OPERATOR), NUM_DOCS, null); assertTrue(filterOperator instanceof MatchAllFilterOperator); }
public static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs, @Nullable Map<String, String> debugOptions) { List<BaseFilterOperator> childFilterOperators = new ArrayList<>(filterOperators.size()); for (BaseFilterOperator filterOperator : filterOperators) { if (filterOperator.isResultMatchingAll()) { return new MatchAllFilterOperator(numDocs); } else if (!filterOperator.isResultEmpty()) { childFilterOperators.add(filterOperator); } } int numChildFilterOperators = childFilterOperators.size(); if (numChildFilterOperators == 0) { return EmptyFilterOperator.getInstance(); } else if (numChildFilterOperators == 1) { return childFilterOperators.get(0); } else { return new OrFilterOperator(childFilterOperators, numDocs); } }
FilterOperatorUtils { public static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs, @Nullable Map<String, String> debugOptions) { List<BaseFilterOperator> childFilterOperators = new ArrayList<>(filterOperators.size()); for (BaseFilterOperator filterOperator : filterOperators) { if (filterOperator.isResultMatchingAll()) { return new MatchAllFilterOperator(numDocs); } else if (!filterOperator.isResultEmpty()) { childFilterOperators.add(filterOperator); } } int numChildFilterOperators = childFilterOperators.size(); if (numChildFilterOperators == 0) { return EmptyFilterOperator.getInstance(); } else if (numChildFilterOperators == 1) { return childFilterOperators.get(0); } else { return new OrFilterOperator(childFilterOperators, numDocs); } } }
FilterOperatorUtils { public static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs, @Nullable Map<String, String> debugOptions) { List<BaseFilterOperator> childFilterOperators = new ArrayList<>(filterOperators.size()); for (BaseFilterOperator filterOperator : filterOperators) { if (filterOperator.isResultMatchingAll()) { return new MatchAllFilterOperator(numDocs); } else if (!filterOperator.isResultEmpty()) { childFilterOperators.add(filterOperator); } } int numChildFilterOperators = childFilterOperators.size(); if (numChildFilterOperators == 0) { return EmptyFilterOperator.getInstance(); } else if (numChildFilterOperators == 1) { return childFilterOperators.get(0); } else { return new OrFilterOperator(childFilterOperators, numDocs); } } private  FilterOperatorUtils(); }
FilterOperatorUtils { public static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs, @Nullable Map<String, String> debugOptions) { List<BaseFilterOperator> childFilterOperators = new ArrayList<>(filterOperators.size()); for (BaseFilterOperator filterOperator : filterOperators) { if (filterOperator.isResultMatchingAll()) { return new MatchAllFilterOperator(numDocs); } else if (!filterOperator.isResultEmpty()) { childFilterOperators.add(filterOperator); } } int numChildFilterOperators = childFilterOperators.size(); if (numChildFilterOperators == 0) { return EmptyFilterOperator.getInstance(); } else if (numChildFilterOperators == 1) { return childFilterOperators.get(0); } else { return new OrFilterOperator(childFilterOperators, numDocs); } } private  FilterOperatorUtils(); static BaseFilterOperator getLeafFilterOperator(PredicateEvaluator predicateEvaluator, DataSource dataSource,
      int numDocs); static BaseFilterOperator getAndFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs,
      @Nullable Map<String, String> debugOptions); static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs,
      @Nullable Map<String, String> debugOptions); }
FilterOperatorUtils { public static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs, @Nullable Map<String, String> debugOptions) { List<BaseFilterOperator> childFilterOperators = new ArrayList<>(filterOperators.size()); for (BaseFilterOperator filterOperator : filterOperators) { if (filterOperator.isResultMatchingAll()) { return new MatchAllFilterOperator(numDocs); } else if (!filterOperator.isResultEmpty()) { childFilterOperators.add(filterOperator); } } int numChildFilterOperators = childFilterOperators.size(); if (numChildFilterOperators == 0) { return EmptyFilterOperator.getInstance(); } else if (numChildFilterOperators == 1) { return childFilterOperators.get(0); } else { return new OrFilterOperator(childFilterOperators, numDocs); } } private  FilterOperatorUtils(); static BaseFilterOperator getLeafFilterOperator(PredicateEvaluator predicateEvaluator, DataSource dataSource,
      int numDocs); static BaseFilterOperator getAndFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs,
      @Nullable Map<String, String> debugOptions); static BaseFilterOperator getOrFilterOperator(List<BaseFilterOperator> filterOperators, int numDocs,
      @Nullable Map<String, String> debugOptions); static final String USE_SCAN_REORDER_OPTIMIZATION; }