@Test public void combine() { Object filter = new Object(); PlainFilterCombiner<Object, Long, LongContent, LongRange> combiner = new PlainFilterCombiner<>( filter); for (int i = 2; --i >= 0;) { for (int j = 2; --j >= 0;) { for (int k = 2; --k >= 0;) { SelectiveFilter<Object> actual = combiner.combine( FilteredIndexRange.of(TestUtils.THREE_FOUR, new Object(), i == 1), FilteredIndexRange.of(TestUtils.SIX_SEVEN, new Object(), j == 1), new LongContent(k)); Assert.assertEquals(SelectiveFilter.of(filter, i == 1 | j == 1 | k == 1), actual); } } } }
@Override public SelectiveFilter<F> combine( FilteredIndexRange<F, R> firstFilteredRange, FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate) { int cmp = firstFilteredRange.getIndexRange().getEnd().compareTo( secondFilteredRange.getIndexRange().getStart()); int gapSignum = gapEstimate.isZero() ? 0 : 1; Preconditions.checkArgument((cmp < 0 & gapSignum >= 0) || (cmp == 0 & gapSignum == 0)); return SelectiveFilter.of(fixedFilter, !gapEstimate.isZero() || firstFilteredRange.isPotentialOverSelectivity() || secondFilteredRange.isPotentialOverSelectivity()); }
PlainFilterCombiner implements FilterCombiner<F, V, R> { @Override public SelectiveFilter<F> combine( FilteredIndexRange<F, R> firstFilteredRange, FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate) { int cmp = firstFilteredRange.getIndexRange().getEnd().compareTo( secondFilteredRange.getIndexRange().getStart()); int gapSignum = gapEstimate.isZero() ? 0 : 1; Preconditions.checkArgument((cmp < 0 & gapSignum >= 0) || (cmp == 0 & gapSignum == 0)); return SelectiveFilter.of(fixedFilter, !gapEstimate.isZero() || firstFilteredRange.isPotentialOverSelectivity() || secondFilteredRange.isPotentialOverSelectivity()); } }
PlainFilterCombiner implements FilterCombiner<F, V, R> { @Override public SelectiveFilter<F> combine( FilteredIndexRange<F, R> firstFilteredRange, FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate) { int cmp = firstFilteredRange.getIndexRange().getEnd().compareTo( secondFilteredRange.getIndexRange().getStart()); int gapSignum = gapEstimate.isZero() ? 0 : 1; Preconditions.checkArgument((cmp < 0 & gapSignum >= 0) || (cmp == 0 & gapSignum == 0)); return SelectiveFilter.of(fixedFilter, !gapEstimate.isZero() || firstFilteredRange.isPotentialOverSelectivity() || secondFilteredRange.isPotentialOverSelectivity()); } PlainFilterCombiner(F filter); }
PlainFilterCombiner implements FilterCombiner<F, V, R> { @Override public SelectiveFilter<F> combine( FilteredIndexRange<F, R> firstFilteredRange, FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate) { int cmp = firstFilteredRange.getIndexRange().getEnd().compareTo( secondFilteredRange.getIndexRange().getStart()); int gapSignum = gapEstimate.isZero() ? 0 : 1; Preconditions.checkArgument((cmp < 0 & gapSignum >= 0) || (cmp == 0 & gapSignum == 0)); return SelectiveFilter.of(fixedFilter, !gapEstimate.isZero() || firstFilteredRange.isPotentialOverSelectivity() || secondFilteredRange.isPotentialOverSelectivity()); } PlainFilterCombiner(F filter); @Override SelectiveFilter<F> combine(
      FilteredIndexRange<F, R> firstFilteredRange,
      FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate); }
PlainFilterCombiner implements FilterCombiner<F, V, R> { @Override public SelectiveFilter<F> combine( FilteredIndexRange<F, R> firstFilteredRange, FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate) { int cmp = firstFilteredRange.getIndexRange().getEnd().compareTo( secondFilteredRange.getIndexRange().getStart()); int gapSignum = gapEstimate.isZero() ? 0 : 1; Preconditions.checkArgument((cmp < 0 & gapSignum >= 0) || (cmp == 0 & gapSignum == 0)); return SelectiveFilter.of(fixedFilter, !gapEstimate.isZero() || firstFilteredRange.isPotentialOverSelectivity() || secondFilteredRange.isPotentialOverSelectivity()); } PlainFilterCombiner(F filter); @Override SelectiveFilter<F> combine(
      FilteredIndexRange<F, R> firstFilteredRange,
      FilteredIndexRange<F, R> secondFilteredRange, V gapEstimate);  }