From bbbc76cd820b92f2d060b83fa24bad2b8e264dc3 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Tue, 12 Dec 2023 20:24:07 -0800 Subject: [PATCH 1/2] remove search auto strategy, estimateSelectivity of BitmapColumnIndex --- ...ryEncodedStringIndexSupplierBenchmark.java | 1 - docs/querying/searchquery.md | 4 - .../org/apache/druid/query/filter/Filter.java | 19 --- .../druid/query/search/AutoStrategy.java | 134 ------------------ .../query/search/SearchStrategySelector.java | 5 +- .../druid/segment/filter/AndFilter.java | 11 -- .../druid/segment/filter/BoundFilter.java | 9 -- .../filter/ColumnComparisonFilter.java | 6 - .../segment/filter/ExpressionFilter.java | 7 - .../druid/segment/filter/FalseFilter.java | 6 - .../apache/druid/segment/filter/Filters.java | 15 -- .../druid/segment/filter/IsBooleanFilter.java | 6 - .../druid/segment/filter/NotFilter.java | 6 - .../apache/druid/segment/filter/OrFilter.java | 11 -- .../druid/segment/filter/SpatialFilter.java | 14 -- .../druid/segment/filter/TrueFilter.java | 6 - .../index/AllFalseBitmapColumnIndex.java | 6 - .../index/AllTrueBitmapColumnIndex.java | 6 - .../index/AllUnknownBitmapColumnIndex.java | 6 - .../segment/index/BitmapColumnIndex.java | 2 - .../index/IndexedUtf8ValueIndexes.java | 5 - .../index/SimpleImmutableBitmapIndex.java | 6 - .../SimpleImmutableBitmapIterableIndex.java | 6 - .../NestedFieldColumnIndexSupplier.java | 41 ------ .../ScalarDoubleColumnAndIndexSupplier.java | 31 ---- .../ScalarLongColumnAndIndexSupplier.java | 31 ---- .../nested/VariantColumnAndIndexSupplier.java | 18 --- .../virtual/ListFilteredVirtualColumn.java | 23 --- .../search/SearchQueryRunnerWithCaseTest.java | 4 +- .../druid/segment/filter/BaseFilterTest.java | 12 -- .../IncrementalIndexStorageAdapterTest.java | 6 - .../NestedFieldColumnIndexSupplierTest.java | 123 ---------------- ...tionaryEncodedStringIndexSupplierTest.java | 6 - 33 files changed, 3 insertions(+), 589 deletions(-) delete mode 100644 processing/src/main/java/org/apache/druid/query/search/AutoStrategy.java diff --git a/benchmarks/src/test/java/org/apache/druid/benchmark/DictionaryEncodedStringIndexSupplierBenchmark.java b/benchmarks/src/test/java/org/apache/druid/benchmark/DictionaryEncodedStringIndexSupplierBenchmark.java index eef24302f5d6..c80a618a84bb 100644 --- a/benchmarks/src/test/java/org/apache/druid/benchmark/DictionaryEncodedStringIndexSupplierBenchmark.java +++ b/benchmarks/src/test/java/org/apache/druid/benchmark/DictionaryEncodedStringIndexSupplierBenchmark.java @@ -145,6 +145,5 @@ private Iterable intGenerator() public void doValueSetCheck(Blackhole blackhole, BenchmarkState state) { BitmapColumnIndex bitmapIndex = state.stringValueSetIndex.forSortedValuesUtf8(state.values); - bitmapIndex.estimateSelectivity(10_000_000); } } diff --git a/docs/querying/searchquery.md b/docs/querying/searchquery.md index 27da025f1450..c0b5b7411002 100644 --- a/docs/querying/searchquery.md +++ b/docs/querying/searchquery.md @@ -126,10 +126,6 @@ are unique. queryableIndexSegment, and then evaluates search predicates. If some filters support bitmap indexes, the cursor can read only the rows which satisfy those filters, thereby saving I/O cost. However, it might be slow with filters of low selectivity. -- "auto" strategy uses a cost-based planner for choosing an optimal search strategy. It estimates the cost of index-only -and cursor-based execution plans, and chooses the optimal one. Currently, it is not enabled by default due to the overhead -of cost estimation. - ## Server configuration The following runtime properties apply: diff --git a/processing/src/main/java/org/apache/druid/query/filter/Filter.java b/processing/src/main/java/org/apache/druid/query/filter/Filter.java index 49ec82409046..749456cb54c2 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/Filter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/Filter.java @@ -70,25 +70,6 @@ default VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory throw new UOE("Filter[%s] cannot vectorize", getClass().getName()); } - /** - * Estimate selectivity of this filter. - * This method can be used for cost-based query planning like in {@link org.apache.druid.query.search.AutoStrategy}. - * To avoid significant performance degradation for calculating the exact cost, - * implementation of this method targets to achieve rapid selectivity estimation - * with reasonable sacrifice of the accuracy. - * As a result, the estimated selectivity might be different from the exact value. - * - * @param indexSelector Object used to retrieve indexes - * - * @return an estimated selectivity ranging from 0 (filter selects no rows) to 1 (filter selects all rows). - * - * @see Filter#getBitmapColumnIndex(ColumnIndexSelector) - */ - default double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return getBitmapColumnIndex(indexSelector).estimateSelectivity(indexSelector.getNumRows()); - } - /** * Indicates whether this filter supports selectivity estimation. * A filter supports selectivity estimation if it supports bitmap index and diff --git a/processing/src/main/java/org/apache/druid/query/search/AutoStrategy.java b/processing/src/main/java/org/apache/druid/query/search/AutoStrategy.java deleted file mode 100644 index 29d5c3510040..000000000000 --- a/processing/src/main/java/org/apache/druid/query/search/AutoStrategy.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.druid.query.search; - -import org.apache.druid.java.util.emitter.EmittingLogger; -import org.apache.druid.query.dimension.DimensionSpec; -import org.apache.druid.query.filter.ColumnIndexSelector; -import org.apache.druid.segment.ColumnSelector; -import org.apache.druid.segment.ColumnSelectorColumnIndexSelector; -import org.apache.druid.segment.DeprecatedQueryableIndexColumnSelector; -import org.apache.druid.segment.QueryableIndex; -import org.apache.druid.segment.Segment; -import org.apache.druid.segment.column.ColumnHolder; -import org.apache.druid.segment.column.ColumnIndexSupplier; -import org.apache.druid.segment.index.semantic.DictionaryEncodedStringValueIndex; - -import java.util.List; - -public class AutoStrategy extends SearchStrategy -{ - public static final String NAME = "auto"; - - private static final EmittingLogger log = new EmittingLogger(AutoStrategy.class); - - public static AutoStrategy of(SearchQuery query) - { - return new AutoStrategy(query); - } - - private AutoStrategy(SearchQuery query) - { - super(query); - } - - @Override - public List getExecutionPlan(SearchQuery query, Segment segment) - { - final QueryableIndex index = segment.asQueryableIndex(); - - if (index != null) { - final ColumnSelector columnSelector = new DeprecatedQueryableIndexColumnSelector(index); - final ColumnIndexSelector selector = new ColumnSelectorColumnIndexSelector( - index.getBitmapFactoryForDimensions(), - query.getVirtualColumns(), - columnSelector - ); - - // Index-only plan is used only when any filter is not specified or the filter supports bitmap indexes. - // - // Note: if some filters support bitmap indexes but others are not, the current implementation always employs - // the cursor-based plan. This can be more optimized. One possible optimization is generating a bitmap index - // from the non-bitmap-support filters, and then use it to compute the filtered result by intersecting bitmaps. - if (filter == null || filter.supportsSelectivityEstimation(columnSelector, selector)) { - final List dimsToSearch = getDimsToSearch( - index.getAvailableDimensions(), - query.getDimensions() - ); - - // Choose a search query execution strategy depending on the query. - // The costs of index-only plan and cursor-based plan can be computed like below. - // - // c_index = (total cardinality of all search dimensions) * (bitmap intersection cost) - // * (search predicate processing cost) - // c_cursor = (# of rows in a segment) * (filter selectivity) * (# of dimensions) - // * (search predicate processing cost) - final SearchQueryDecisionHelper helper = getDecisionHelper(index); - final double useIndexStrategyCost = helper.getBitmapIntersectCost() * computeTotalCard(index, dimsToSearch); - final double cursorOnlyStrategyCost = (filter == null ? 1. : filter.estimateSelectivity(selector)) - * selector.getNumRows() - * dimsToSearch.size(); - - log.debug( - "Use-index strategy cost: %f, cursor-only strategy cost: %f", - useIndexStrategyCost, - cursorOnlyStrategyCost - ); - - if (useIndexStrategyCost < cursorOnlyStrategyCost) { - log.debug("Use-index execution strategy is selected, query id [%s]", query.getId()); - return UseIndexesStrategy.of(query).getExecutionPlan(query, segment); - } else { - log.debug("Cursor-only execution strategy is selected, query id [%s]", query.getId()); - return CursorOnlyStrategy.of(query).getExecutionPlan(query, segment); - } - } else { - log.debug( - "Filter doesn't support bitmap index. Fall back to cursor-only execution strategy, query id [%s]", - query.getId() - ); - return CursorOnlyStrategy.of(query).getExecutionPlan(query, segment); - } - - } else { - log.debug("Index doesn't exist. Fall back to cursor-only execution strategy, query id [%s]", query.getId()); - return CursorOnlyStrategy.of(query).getExecutionPlan(query, segment); - } - } - - private static long computeTotalCard(final QueryableIndex index, final Iterable dimensionSpecs) - { - long totalCard = 0; - for (DimensionSpec dimension : dimensionSpecs) { - final ColumnHolder columnHolder = index.getColumnHolder(dimension.getDimension()); - if (columnHolder != null) { - final ColumnIndexSupplier indexSupplier = columnHolder.getIndexSupplier(); - if (indexSupplier != null) { - final DictionaryEncodedStringValueIndex bitmapIndex = - indexSupplier.as(DictionaryEncodedStringValueIndex.class); - if (bitmapIndex != null) { - totalCard += bitmapIndex.getCardinality(); - } - } - } - } - return totalCard; - } -} diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java b/processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java index 9f96ab15f9ed..16493e195012 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchStrategySelector.java @@ -40,9 +40,8 @@ public SearchStrategy strategize(SearchQuery query) final String strategyString = config.withOverrides(query).getSearchStrategy(); switch (strategyString) { - case AutoStrategy.NAME: - log.debug("Auto strategy is selected, query id [%s]", query.getId()); - return AutoStrategy.of(query); + case "auto": + log.debug("Auto strategy is selected but has been removed, using 'use-index' strategy instead for query id [%s]", query.getId()); case UseIndexesStrategy.NAME: log.debug("Use-index strategy is selected, query id [%s]", query.getId()); return UseIndexesStrategy.of(query); diff --git a/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java index 20dc33b88427..69884c527a1f 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/AndFilter.java @@ -114,17 +114,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return finalMerged; } - @Override - public double estimateSelectivity(int totalRows) - { - // Estimate selectivity with attribute value independence assumption - double selectivity = 1.0; - for (final Filter filter : filters) { - selectivity *= filter.estimateSelectivity(selector); - } - return selectivity; - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java index a75da57654eb..268bfdffb39c 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java @@ -169,15 +169,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return rangeIndex.getIndexCapabilities().merge(nullBitmap.getIndexCapabilities()); } - @Override - public double estimateSelectivity(int totalRows) - { - return Math.min( - 1.0, - rangeIndex.estimateSelectivity(totalRows) + nullBitmap.estimateSelectivity(totalRows) - ); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java index ed1590dc16ef..15fc13339a04 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java @@ -153,12 +153,6 @@ public Set getRequiredColumns() return dimensions.stream().map(DimensionSpec::getDimension).collect(Collectors.toSet()); } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - throw new UnsupportedOperationException(); - } - @Override public boolean equals(Object o) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java index 1208865d4ce1..6c2acdcd2bca 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java @@ -240,13 +240,6 @@ public boolean supportsSelectivityEstimation( return false; } - @Override - public double estimateSelectivity(final ColumnIndexSelector indexSelector) - { - // Selectivity estimation not supported. - throw new UnsupportedOperationException(); - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java index ba63984fd2ea..c68fc2b9d476 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java @@ -55,12 +55,6 @@ public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) return new AllFalseBitmapColumnIndex(selector.getBitmapFactory()); } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return 0; - } - @Override public ValueMatcher makeMatcher(ColumnSelectorFactory factory) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java index 54a20461ce9f..d6ef5cb46ae2 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java @@ -52,7 +52,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; @@ -174,20 +173,6 @@ public static boolean supportsSelectivityEstimation( return false; } - public static double estimateSelectivity( - final Iterator bitmaps, - final long totalNumRows - ) - { - long numMatchedRows = 0; - while (bitmaps.hasNext()) { - final ImmutableBitmap bitmap = bitmaps.next(); - numMatchedRows += bitmap.size(); - } - - return Math.min(1, (double) numMatchedRows / totalNumRows); - } - @Nullable public static Filter convertToCNFFromQueryContext(Query query, @Nullable Filter filter) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java index ddf3972ccff8..f00ac7a0f2ba 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java @@ -79,12 +79,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return baseIndex.getIndexCapabilities(); } - @Override - public double estimateSelectivity(int totalRows) - { - return 1. - baseFilter.estimateSelectivity(selector); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java index 389c9ceae360..8d7fb39c2c06 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java @@ -81,12 +81,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return baseIndex.getIndexCapabilities(); } - @Override - public double estimateSelectivity(int totalRows) - { - return 1. - baseFilter.estimateSelectivity(selector); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java index 2426a9882ce1..e03bf0344824 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/OrFilter.java @@ -100,17 +100,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return finalMerged; } - @Override - public double estimateSelectivity(int totalRows) - { - // Estimate selectivity with attribute value independence assumption - double selectivity = 0; - for (final Filter filter : filters) { - selectivity += filter.estimateSelectivity(selector); - } - return Math.min(selectivity, 1.); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java index 33852d75e1fd..78dc5bf9126e 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java @@ -90,13 +90,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return new SimpleColumnIndexCapabilities(true, true); } - @Override - public double estimateSelectivity(int totalRows) - { - // selectivity estimation for multi-value columns is not implemented yet. - throw new UnsupportedOperationException(); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { @@ -129,13 +122,6 @@ public Set getRequiredColumns() return ImmutableSet.of(dimension); } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - // selectivity estimation for multi-value columns is not implemented yet. - throw new UnsupportedOperationException(); - } - @Override public boolean equals(Object o) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java index 565e0db6b9d0..da0fb9f4a106 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java @@ -100,12 +100,6 @@ public Filter rewriteRequiredColumns(Map columnRewrites) return this; } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return 1; - } - @Override public String toString() { diff --git a/processing/src/main/java/org/apache/druid/segment/index/AllFalseBitmapColumnIndex.java b/processing/src/main/java/org/apache/druid/segment/index/AllFalseBitmapColumnIndex.java index ba46e39da2ac..d0469dffe560 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/AllFalseBitmapColumnIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/AllFalseBitmapColumnIndex.java @@ -50,12 +50,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return SimpleColumnIndexCapabilities.getConstant(); } - @Override - public double estimateSelectivity(int totalRows) - { - return 0; - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/index/AllTrueBitmapColumnIndex.java b/processing/src/main/java/org/apache/druid/segment/index/AllTrueBitmapColumnIndex.java index db3a0293cfa1..02ff2c5bccaa 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/AllTrueBitmapColumnIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/AllTrueBitmapColumnIndex.java @@ -39,12 +39,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return SimpleColumnIndexCapabilities.getConstant(); } - @Override - public double estimateSelectivity(int totalRows) - { - return 1; - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/index/AllUnknownBitmapColumnIndex.java b/processing/src/main/java/org/apache/druid/segment/index/AllUnknownBitmapColumnIndex.java index b247face7136..a33ae663d53d 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/AllUnknownBitmapColumnIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/AllUnknownBitmapColumnIndex.java @@ -44,12 +44,6 @@ public ColumnIndexCapabilities getIndexCapabilities() return SimpleColumnIndexCapabilities.getConstant(); } - @Override - public double estimateSelectivity(int totalRows) - { - return 0; - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/index/BitmapColumnIndex.java b/processing/src/main/java/org/apache/druid/segment/index/BitmapColumnIndex.java index 231701543359..3a0105e9dbab 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/BitmapColumnIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/BitmapColumnIndex.java @@ -30,8 +30,6 @@ public interface BitmapColumnIndex { ColumnIndexCapabilities getIndexCapabilities(); - double estimateSelectivity(int totalRows); - /** * Compute a bitmap result wrapped with the {@link BitmapResultFactory} representing the rows matched by this index. * diff --git a/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java b/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java index 9964cd225c92..b00f7346d40f 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java +++ b/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java @@ -82,11 +82,6 @@ public BitmapColumnIndex forValue(@Nullable String value) final ByteBuffer utf8 = StringUtils.toUtf8ByteBuffer(value); return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - return Math.min(1, (double) getBitmapForValue().size() / totalRows); - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIndex.java b/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIndex.java index ec68b3419e14..7c6f6023ed0a 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIndex.java @@ -35,12 +35,6 @@ public SimpleImmutableBitmapIndex(ImmutableBitmap bitmap) this.bitmap = bitmap; } - @Override - public double estimateSelectivity(int totalRows) - { - return Math.min(1, (double) bitmap.size() / totalRows); - } - @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) { diff --git a/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIterableIndex.java b/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIterableIndex.java index 99bc1d5702ec..e92cb02dfb59 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIterableIndex.java +++ b/processing/src/main/java/org/apache/druid/segment/index/SimpleImmutableBitmapIterableIndex.java @@ -22,7 +22,6 @@ import com.google.common.collect.Iterables; import org.apache.druid.collections.bitmap.ImmutableBitmap; import org.apache.druid.query.BitmapResultFactory; -import org.apache.druid.segment.filter.Filters; import javax.annotation.Nullable; import java.util.Collections; @@ -32,11 +31,6 @@ */ public abstract class SimpleImmutableBitmapIterableIndex extends SimpleBitmapColumnIndex { - @Override - public double estimateSelectivity(int totalRows) - { - return Filters.estimateSelectivity(getBitmapIterable().iterator(), totalRows); - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java index 2fb02701f75e..4f797c9ae9fe 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java @@ -374,15 +374,6 @@ public BitmapColumnIndex forValue(@Nullable String value) { final FixedIndexed localDictionary = localDictionarySupplier.get(); final Indexed stringDictionary = globalStringDictionarySupplier.get(); - @Override - public double estimateSelectivity(int totalRows) - { - final int globalId = stringDictionary.indexOf(StringUtils.toUtf8ByteBuffer(value)); - if (globalId < 0) { - return 0.0; - } - return (double) getBitmap(localDictionary.indexOf(globalId)).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -664,22 +655,6 @@ public BitmapColumnIndex forValue(@Nullable String value) final FixedIndexed localDictionary = localDictionarySupplier.get(); final FixedIndexed longDictionary = globalLongDictionarySupplier.get(); - @Override - public double estimateSelectivity(int totalRows) - { - if (longValue == null) { - if (inputNull) { - return (double) getBitmap(localDictionary.indexOf(0)).size() / totalRows; - } else { - return 0.0; - } - } - final int globalId = longDictionary.indexOf(longValue); - if (globalId < 0) { - return 0.0; - } - return (double) getBitmap(localDictionary.indexOf(globalId + adjustLongId)).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -924,22 +899,6 @@ public BitmapColumnIndex forValue(@Nullable String value) { final FixedIndexed localDictionary = localDictionarySupplier.get(); final FixedIndexed doubleDictionary = globalDoubleDictionarySupplier.get(); - @Override - public double estimateSelectivity(int totalRows) - { - if (doubleValue == null) { - if (inputNull) { - return (double) getBitmap(localDictionary.indexOf(0)).size() / totalRows; - } else { - return 0.0; - } - } - final int globalId = doubleDictionary.indexOf(doubleValue); - if (globalId < 0) { - return 0.0; - } - return (double) getBitmap(localDictionary.indexOf(globalId + adjustDoubleId)).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java index b5a31448302f..821581733b65 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java @@ -242,15 +242,6 @@ public BitmapColumnIndex forValue(@Nonnull Object value, TypeSignature dictionary = doubleDictionarySupplier.get(); - @Override - public double estimateSelectivity(int totalRows) - { - final int id = dictionary.indexOf(doubleValue); - if (id < 0) { - return 0.0; - } - return (double) getBitmap(id).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -285,28 +276,6 @@ public BitmapColumnIndex forValue(@Nullable String value) return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - if (doubleValue == null) { - if (inputNull && NullHandling.sqlCompatible()) { - return (double) getBitmap(0).size() / totalRows; - } else { - return 0.0; - } - } - if (NullHandling.replaceWithDefault() && doubleValue.equals(NullHandling.defaultDoubleValue())) { - if (defaultValueIndex >= 0) { - return ((double) getBitmap(0).size() + (double) getBitmap(defaultValueIndex).size()) / totalRows; - } - return (double) getBitmap(0).size() / totalRows; - } - final int id = dictionary.indexOf(doubleValue); - if (id < 0) { - return 0.0; - } - return (double) getBitmap(id).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java index 754e7ba89485..354438d37a35 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java @@ -243,15 +243,6 @@ public BitmapColumnIndex forValue(@Nonnull Object value, TypeSignature dictionary = longDictionarySupplier.get(); - @Override - public double estimateSelectivity(int totalRows) - { - final int id = dictionary.indexOf(longValue); - if (id < 0) { - return 0.0; - } - return (double) getBitmap(id).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -286,28 +277,6 @@ public BitmapColumnIndex forValue(@Nullable String value) final Long longValue = GuavaUtils.tryParseLong(value); return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - if (longValue == null) { - if (inputNull && NullHandling.sqlCompatible()) { - return (double) getBitmap(0).size() / totalRows; - } else { - return 0.0; - } - } - if (NullHandling.replaceWithDefault() && longValue.equals(NullHandling.defaultLongValue())) { - if (defaultValueIndex >= 0) { - return ((double) getBitmap(0).size() + (double) getBitmap(defaultValueIndex).size()) / totalRows; - } - return (double) getBitmap(0).size() / totalRows; - } - final int id = dictionary.indexOf(longValue); - if (id < 0) { - return 0.0; - } - return (double) getBitmap(id).size() / totalRows; - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/nested/VariantColumnAndIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/VariantColumnAndIndexSupplier.java index f81bffcd2517..2462aa18cb09 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/VariantColumnAndIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/VariantColumnAndIndexSupplier.java @@ -374,15 +374,6 @@ public BitmapColumnIndex forValue(@Nonnull Object value, TypeSignature T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -448,15 +439,6 @@ public BitmapColumnIndex containsValue(@Nullable Object value, TypeSignature T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java b/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java index fa0aea6778af..f48e051b0375 100644 --- a/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java +++ b/processing/src/main/java/org/apache/druid/segment/virtual/ListFilteredVirtualColumn.java @@ -49,7 +49,6 @@ import org.apache.druid.segment.column.ColumnCapabilitiesImpl; import org.apache.druid.segment.column.ColumnHolder; import org.apache.druid.segment.column.ColumnIndexSupplier; -import org.apache.druid.segment.filter.Filters; import org.apache.druid.segment.index.BitmapColumnIndex; import org.apache.druid.segment.index.SimpleBitmapColumnIndex; import org.apache.druid.segment.index.SimpleImmutableBitmapIterableIndex; @@ -415,14 +414,6 @@ public BitmapColumnIndex get() { return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - return Filters.estimateSelectivity( - Collections.singletonList(nullValueBitmapSupplier.get()).iterator(), - totalRows - ); - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknowns) @@ -453,11 +444,6 @@ public BitmapColumnIndex forValue(@Nullable String value) { return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - return Math.min(1, (double) getBitmapForValue().size() / totalRows); - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) @@ -558,15 +544,6 @@ public BitmapColumnIndex forPredicate(DruidPredicateFactory matcherFactory) { return new SimpleBitmapColumnIndex() { - @Override - public double estimateSelectivity(int totalRows) - { - final int start = 0, end = getCardinality(); - return Filters.estimateSelectivity( - getBitmapsInRange(matcherFactory.makeStringPredicate(), start, end).iterator(), - totalRows - ); - } @Override public T computeBitmapResult(BitmapResultFactory bitmapResultFactory, boolean includeUnknown) diff --git a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java index 0bcb40fdcf52..bad6f4da41b5 100644 --- a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java +++ b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java @@ -57,13 +57,11 @@ public class SearchQueryRunnerWithCaseTest extends InitializedNullHandlingTest @Parameterized.Parameters public static Iterable constructorFeeder() { - final SearchQueryConfig[] configs = new SearchQueryConfig[3]; + final SearchQueryConfig[] configs = new SearchQueryConfig[2]; configs[0] = new SearchQueryConfig(); configs[0].setSearchStrategy(UseIndexesStrategy.NAME); configs[1] = new SearchQueryConfig(); configs[1].setSearchStrategy(CursorOnlyStrategy.NAME); - configs[2] = new SearchQueryConfig(); - configs[2].setSearchStrategy(AutoStrategy.NAME); CharSource input = CharSource.wrap( "2011-01-12T00:00:00.000Z\tspot\tAutoMotive\t1000\t10000.0\t10000.0\t100000\t10\t10.0\t10.0\tPREFERRED\ta\u0001preferred\t100.000000\n" + diff --git a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java index 69b6cefde487..43eb56fd850a 100644 --- a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java @@ -833,12 +833,6 @@ public Set getRequiredColumns() return Collections.emptySet(); } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return 1.0; - } - @Nullable @Override public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) @@ -909,12 +903,6 @@ public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, Colu return false; } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return 1.0; - } - @Nullable @Override public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) diff --git a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java index a7045b329b75..603c3ad866db 100644 --- a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java @@ -639,12 +639,6 @@ public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) return new AllTrueBitmapColumnIndex(selector); } - @Override - public double estimateSelectivity(ColumnIndexSelector indexSelector) - { - return 1; - } - @Override public ValueMatcher makeMatcher(ColumnSelectorFactory factory) { diff --git a/processing/src/test/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplierTest.java b/processing/src/test/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplierTest.java index 72f7dfafdff9..67be3dc911c0 100644 --- a/processing/src/test/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplierTest.java +++ b/processing/src/test/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplierTest.java @@ -170,7 +170,6 @@ public void testSingleTypeStringColumnValueIndex() throws IOException BitmapColumnIndex columnIndex = nullIndex.get(); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); Assert.assertEquals(0, bitmap.size()); } @@ -189,21 +188,18 @@ public void testSingleTypeStringColumnValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("b"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.4, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 7, 8); // non-existent in local column columnIndex = valueSetIndex.forValue("fo"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("b", "fooo", "z"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.8, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 2, 3, 4, 5, 6, 7, 8); } @@ -223,144 +219,118 @@ public void testSingleTypeStringColumnRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndex.forRange(null, false, "a", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange(null, true, "a", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange(null, false, "b", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange(null, false, "b", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 7, 8); forRange = rangeIndex.forRange("a", false, "b", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange("a", true, "b", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 7, 8); forRange = rangeIndex.forRange("b", false, "fon", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 7, 8); forRange = rangeIndex.forRange("bb", false, "fon", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange("b", true, "foo", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 9); forRange = rangeIndex.forRange("f", true, "g", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 5, 9); forRange = rangeIndex.forRange(null, false, "g", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.8, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 5, 7, 8, 9); forRange = rangeIndex.forRange("f", false, null, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 6, 9); forRange = rangeIndex.forRange("b", true, "fooo", true); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 9); forRange = rangeIndex.forRange("b", true, "fooo", false); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 5, 9); forRange = rangeIndex.forRange(null, true, "fooo", true); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 3, 7, 8, 9); forRange = rangeIndex.forRange("b", true, null, false); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 6, 9); forRange = rangeIndex.forRange("b", false, null, true); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndex.forRange(null, true, "fooo", false); - Assert.assertEquals(0.8, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 5, 7, 8, 9); forRange = rangeIndex.forRange(null, true, null, true); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndex.forRange(null, false, null, false); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndex.forRange(null, true, "foa", false); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 7, 8); forRange = rangeIndex.forRange(null, true, "foooa", false); - Assert.assertEquals(0.8, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 5, 7, 8, 9); forRange = rangeIndex.forRange("foooa", true, "ggg", false); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange("g", true, "gg", false); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange("z", true, "zz", false); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange("z", false, "zz", false); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 4, 6); } @@ -384,7 +354,6 @@ public void testSingleTypeStringColumnRangeIndexWithPredicate() throws IOExcepti true, s -> !"fooo".equals(s) ); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 9); @@ -395,7 +364,6 @@ public void testSingleTypeStringColumnRangeIndexWithPredicate() throws IOExcepti true, s -> "fooo".equals(s) ); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 5); @@ -406,7 +374,6 @@ public void testSingleTypeStringColumnRangeIndexWithPredicate() throws IOExcepti false, s -> !"fooo".equals(s) ); - Assert.assertEquals(0.8, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 3, 4, 6, 7, 8, 9); @@ -417,7 +384,6 @@ public void testSingleTypeStringColumnRangeIndexWithPredicate() throws IOExcepti true, s -> !"fooo".equals(s) ); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 3, 7, 8, 9); @@ -428,7 +394,6 @@ public void testSingleTypeStringColumnRangeIndexWithPredicate() throws IOExcepti true, s -> true ); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 6, 9); } @@ -451,7 +416,6 @@ public void testSingleTypeStringColumnPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.6, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 6, 7, 8); } @@ -470,7 +434,6 @@ public void testSingleTypeStringColumnWithNullValueIndex() throws IOException BitmapColumnIndex columnIndex = nullIndex.get(); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 7, 8); } @@ -489,21 +452,18 @@ public void testSingleTypeStringColumnWithNullValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("b"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.1, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 3); // non-existent in local column columnIndex = valueSetIndex.forValue("fo"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("b", "fooo", "z"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.5, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 3, 4, 5, 6); } @@ -522,78 +482,64 @@ public void testSingleValueStringWithNullRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndex.forRange("f", true, "g", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 5, 9); forRange = rangeIndex.forRange(null, false, "g", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.5, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 3, 5, 9); forRange = rangeIndex.forRange(null, false, "a", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange(null, false, "b", true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndex.forRange(null, false, "b", false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.1, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 3); forRange = rangeIndex.forRange("f", false, null, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 6, 9); forRange = rangeIndex.forRange("b", true, "fooo", true); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 9); forRange = rangeIndex.forRange("b", true, "fooo", false); - Assert.assertEquals(0.4, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 5, 9); forRange = rangeIndex.forRange(null, true, "fooo", true); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 3, 9); forRange = rangeIndex.forRange("b", true, null, false); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 6, 9); forRange = rangeIndex.forRange("b", false, null, true); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 3, 4, 5, 6, 9); forRange = rangeIndex.forRange(null, true, "fooo", false); - Assert.assertEquals(0.5, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 3, 5, 9); forRange = rangeIndex.forRange(null, true, null, true); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 3, 4, 5, 6, 9); forRange = rangeIndex.forRange(null, false, null, false); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 3, 4, 5, 6, 9); } @@ -616,7 +562,6 @@ public void testSingleValueStringWithNullPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 3, 4, 6); } @@ -638,14 +583,12 @@ public void testSingleTypeLongColumnValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("1"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 9); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("1", "300", "700"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.6, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 2, 3, 7, 8, 9); } @@ -664,57 +607,47 @@ public void testSingleTypeLongColumnRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndexes.forRange(10L, true, 400L, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.5, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 6, 7, 8); forRange = rangeIndexes.forRange(1, true, 3, true); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(1, false, 3, true); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 9); forRange = rangeIndexes.forRange(1, false, 3, false); - Assert.assertEquals(0.5, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 5, 9); forRange = rangeIndexes.forRange(100L, true, 300L, true); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(100L, true, 300L, false); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 7, 8); forRange = rangeIndexes.forRange(100L, false, 300L, true); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 6); forRange = rangeIndexes.forRange(100L, false, 300L, false); - Assert.assertEquals(0.5, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 6, 7, 8); forRange = rangeIndexes.forRange(null, true, null, true); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndexes.forRange(null, false, null, false); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); } @@ -737,7 +670,6 @@ public void testSingleTypeLongColumnPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.5, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 5, 9); } @@ -756,7 +688,6 @@ public void testSingleTypeLongColumnWithNullValueIndex() throws IOException BitmapColumnIndex columnIndex = nullIndex.get(); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 5, 8); } @@ -775,14 +706,12 @@ public void testSingleTypeLongColumnWithNullValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("3"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.1, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 4); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("1", "3", "300"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.5, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 7, 9); @@ -794,14 +723,12 @@ public void testSingleTypeLongColumnWithNullValueSetIndex() throws IOException treeSet.add("300"); columnIndex = valueSetIndex.forSortedValues(treeSet); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.8, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 2, 3, 4, 5, 7, 8, 9); // null value should really use NullValueIndex, but this works for classic reasons columnIndex = valueSetIndex.forValue(null); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 5, 8); } @@ -820,53 +747,43 @@ public void testSingleValueLongWithNullRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndexes.forRange(100, false, 700, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 6, 7); forRange = rangeIndexes.forRange(100, true, 300, true); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(100, false, 300, true); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 6); forRange = rangeIndexes.forRange(100, true, 300, false); - Assert.assertEquals(0.1, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 7); forRange = rangeIndexes.forRange(100, false, 300, false); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 6, 7); forRange = rangeIndexes.forRange(null, true, null, true); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 3, 4, 6, 7, 9); forRange = rangeIndexes.forRange(null, false, null, false); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 3, 4, 6, 7, 9); forRange = rangeIndexes.forRange(null, false, 0, false); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(null, false, 1, false); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 9); forRange = rangeIndexes.forRange(null, false, 1, true); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); } @@ -889,7 +806,6 @@ public void testSingleValueLongWithNullPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 4, 6); } @@ -911,14 +827,12 @@ public void testSingleTypeDoubleColumnValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("1.2"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 4, 7); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("1.2", "3.3", "6.6"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.7, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 3, 4, 5, 6, 7, 9); } @@ -937,80 +851,68 @@ public void testSingleTypeDoubleColumnRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndexes.forRange(1.0, true, 5.0, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.9, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 6, 7, 8, 9); forRange = rangeIndexes.forRange(1.1, false, 3.3, false); Assert.assertNotNull(forRange); - Assert.assertEquals(0.9, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 6, 7, 8, 9); forRange = rangeIndexes.forRange(1.1, true, 3.3, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.3, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 4, 7); forRange = rangeIndexes.forRange(null, true, null, true); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndexes.forRange(null, false, null, false); - Assert.assertEquals(1.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); forRange = rangeIndexes.forRange(1.111, true, 1.19, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(1.01, true, 1.09, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(0.05, true, 0.98, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(0.05, true, 1.1, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(8.99, true, 10.10, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(8.99, true, 10.10, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(10.00, true, 10.10, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); @@ -1034,7 +936,6 @@ public void testSingleTypeDoubleColumnPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.6, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 3, 4, 6, 7, 9); } @@ -1053,7 +954,6 @@ public void testSingleTypeDoubleColumnWithNullValueIndex() throws IOException BitmapColumnIndex columnIndex = nullIndex.get(); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 6); } @@ -1072,14 +972,12 @@ public void testSingleTypeDoubleColumnWithNullValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("6.6"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.1, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 5); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("1.2", "3.3", "7.7"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.4, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 4, 7, 9); @@ -1091,14 +989,12 @@ public void testSingleTypeDoubleColumnWithNullValueSetIndex() throws IOException treeSet.add("7.7"); columnIndex = valueSetIndex.forSortedValues(treeSet); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.7, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 2, 3, 4, 6, 7, 9); // null value should really use NullValueIndex, but this works for classic reasons columnIndex = valueSetIndex.forValue(null); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 6); } @@ -1117,38 +1013,31 @@ public void testSingleValueDoubleWithNullRangeIndex() throws IOException BitmapColumnIndex forRange = rangeIndexes.forRange(1.1, false, 5.0, true); Assert.assertNotNull(forRange); - Assert.assertEquals(0.6, forRange.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 7, 8, 9); forRange = rangeIndexes.forRange(null, true, null, true); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 7, 8, 9); forRange = rangeIndexes.forRange(null, false, null, false); - Assert.assertEquals(0.7, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 2, 4, 5, 7, 8, 9); forRange = rangeIndexes.forRange(null, true, 1.0, true); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); forRange = rangeIndexes.forRange(null, true, 1.1, false); - Assert.assertEquals(0.2, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 8); forRange = rangeIndexes.forRange(6.6, false, null, false); - Assert.assertEquals(0.1, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 5); forRange = rangeIndexes.forRange(6.6, true, null, false); - Assert.assertEquals(0.0, forRange.estimateSelectivity(ROW_COUNT), 0.0); bitmap = forRange.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); } @@ -1171,7 +1060,6 @@ public void testSingleValueDoubleWithNullPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.4, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 4, 7, 9); } @@ -1193,7 +1081,6 @@ public void testVariantNullValueIndex() throws IOException BitmapColumnIndex columnIndex = nullIndex.get(); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.2, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 7); } @@ -1212,26 +1099,22 @@ public void testVariantValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("b"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.2, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 9); columnIndex = valueSetIndex.forValue("1"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.2, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 5); columnIndex = valueSetIndex.forValue("1.1"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.1, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 8); // set index columnIndex = valueSetIndex.forSortedValues(new TreeSet<>(ImmutableSet.of("b", "300", "9.9", "1.6"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.4, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 9); @@ -1244,14 +1127,12 @@ public void testVariantValueSetIndex() throws IOException treeSet.add("1.6"); columnIndex = valueSetIndex.forSortedValues(treeSet); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.6, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 2, 3, 4, 7, 9); // null value should really use NullValueIndex, but this works for classic reasons columnIndex = valueSetIndex.forValue(null); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.2, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 7); } @@ -1286,7 +1167,6 @@ public void testVariantPredicateIndex() throws IOException BitmapColumnIndex columnIndex = predicateIndex.forPredicate(predicateFactory); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.5, columnIndex.estimateSelectivity(ROW_COUNT), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 1, 3, 4, 6, 9); } @@ -1442,19 +1322,16 @@ public void testEnsureNoImproperSelectionFromAdjustedGlobals() throws IOExceptio BitmapColumnIndex columnIndex = valueSetIndex.forValue("1"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3333, columnIndex.estimateSelectivity(3), 0.001); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0); columnIndex = valueSetIndex.forValue("-2"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.3333, columnIndex.estimateSelectivity(3), 0.001); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2); columnIndex = valueSetIndex.forValue("2"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(3), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); } diff --git a/processing/src/test/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplierTest.java b/processing/src/test/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplierTest.java index ebf39d5c0d6e..263b4132dd7d 100644 --- a/processing/src/test/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplierTest.java +++ b/processing/src/test/java/org/apache/druid/segment/serde/DictionaryEncodedStringIndexSupplierTest.java @@ -62,42 +62,36 @@ public void testStringColumnWithNullValueSetIndex() throws IOException BitmapColumnIndex columnIndex = valueSetIndex.forValue("b"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.1, columnIndex.estimateSelectivity(10), 0.0); ImmutableBitmap bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 3); // non-existent in local column columnIndex = valueSetIndex.forValue("fo"); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(10), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); // set index columnIndex = valueSetIndex.forSortedValues(InDimFilter.ValuesSet.copyOf(ImmutableSet.of("b", "fooo", "z"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.5, columnIndex.estimateSelectivity(10), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 2, 3, 4, 5, 6); // set index with single value in middle columnIndex = valueSetIndex.forSortedValues(InDimFilter.ValuesSet.copyOf(ImmutableSet.of("foo"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.2, columnIndex.estimateSelectivity(10), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap, 0, 9); // set index with no element in column and all elements less than lowest non-null value columnIndex = valueSetIndex.forSortedValues(InDimFilter.ValuesSet.copyOf(ImmutableSet.of("a", "aa", "aaa"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(10), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); // set index with no element in column and all elements greater than highest non-null value columnIndex = valueSetIndex.forSortedValues(InDimFilter.ValuesSet.copyOf(ImmutableSet.of("zz", "zzz", "zzzz"))); Assert.assertNotNull(columnIndex); - Assert.assertEquals(0.0, columnIndex.estimateSelectivity(10), 0.0); bitmap = columnIndex.computeBitmapResult(bitmapResultFactory, false); checkBitmap(bitmap); } From 5b3fe2d82976ea511983ec9b736ffbd2645614dd Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Wed, 13 Dec 2023 00:36:59 -0800 Subject: [PATCH 2/2] more cleanup --- .../filter/ArrayContainsElementFilter.java | 7 ---- .../druid/query/filter/BooleanFilter.java | 11 ------ .../druid/query/filter/EqualityFilter.java | 7 ---- .../org/apache/druid/query/filter/Filter.java | 13 ------- .../druid/query/filter/InDimFilter.java | 7 ---- .../apache/druid/query/filter/NullFilter.java | 7 ---- .../druid/query/filter/RangeFilter.java | 7 ---- .../search/ConciseBitmapDecisionHelper.java | 38 ------------------- .../search/RoaringBitmapDecisionHelper.java | 38 ------------------- .../search/SearchQueryDecisionHelper.java | 35 ----------------- .../druid/query/search/SearchStrategy.java | 16 -------- .../druid/segment/filter/BoundFilter.java | 7 ---- .../filter/ColumnComparisonFilter.java | 7 ---- .../filter/DimensionPredicateFilter.java | 7 ---- .../segment/filter/ExpressionFilter.java | 10 ----- .../druid/segment/filter/FalseFilter.java | 7 ---- .../apache/druid/segment/filter/Filters.java | 18 --------- .../druid/segment/filter/IsBooleanFilter.java | 7 ---- .../segment/filter/JavaScriptFilter.java | 7 ---- .../druid/segment/filter/LikeFilter.java | 7 ---- .../druid/segment/filter/NotFilter.java | 7 ---- .../druid/segment/filter/SelectorFilter.java | 7 ---- .../druid/segment/filter/SpatialFilter.java | 7 ---- .../druid/segment/filter/TrueFilter.java | 7 ---- .../search/SearchQueryRunnerWithCaseTest.java | 5 ++- .../druid/segment/filter/BaseFilterTest.java | 13 ------- .../IncrementalIndexStorageAdapterTest.java | 7 ---- 27 files changed, 4 insertions(+), 312 deletions(-) delete mode 100644 processing/src/main/java/org/apache/druid/query/search/ConciseBitmapDecisionHelper.java delete mode 100644 processing/src/main/java/org/apache/druid/query/search/RoaringBitmapDecisionHelper.java delete mode 100644 processing/src/main/java/org/apache/druid/query/search/SearchQueryDecisionHelper.java diff --git a/processing/src/main/java/org/apache/druid/query/filter/ArrayContainsElementFilter.java b/processing/src/main/java/org/apache/druid/query/filter/ArrayContainsElementFilter.java index a8a245327cf5..013c4fb7c6d2 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/ArrayContainsElementFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/ArrayContainsElementFilter.java @@ -40,7 +40,6 @@ import org.apache.druid.segment.BaseLongColumnValueSelector; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.DimensionSelector; import org.apache.druid.segment.column.ColumnCapabilities; @@ -271,12 +270,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) ).makeMatcher(predicateFactory); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, column, columnSelector, indexSelector); - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/query/filter/BooleanFilter.java b/processing/src/main/java/org/apache/druid/query/filter/BooleanFilter.java index cde4a11cd14b..0ff864258a9b 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/BooleanFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/BooleanFilter.java @@ -19,7 +19,6 @@ package org.apache.druid.query.filter; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import java.util.HashSet; @@ -70,14 +69,4 @@ default Set getRequiredColumns() return allColumns; } - @Override - default boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - for (Filter filter : getFilters()) { - if (!filter.supportsSelectivityEstimation(columnSelector, indexSelector)) { - return false; - } - } - return true; - } } diff --git a/processing/src/main/java/org/apache/druid/query/filter/EqualityFilter.java b/processing/src/main/java/org/apache/druid/query/filter/EqualityFilter.java index f98a300b3dc3..b1bdd5c2dbec 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/EqualityFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/EqualityFilter.java @@ -44,7 +44,6 @@ import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessorFactory; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.DimensionSelector; import org.apache.druid.segment.column.ColumnCapabilities; @@ -267,12 +266,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) ).makeMatcher(new EqualityPredicateFactory(matchValueEval)); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, column, columnSelector, indexSelector); - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/query/filter/Filter.java b/processing/src/main/java/org/apache/druid/query/filter/Filter.java index 749456cb54c2..e7ef20790c0d 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/Filter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/Filter.java @@ -24,7 +24,6 @@ import org.apache.druid.query.BitmapResultFactory; import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.index.BitmapColumnIndex; import org.apache.druid.segment.vector.VectorColumnSelectorFactory; @@ -70,18 +69,6 @@ default VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory throw new UOE("Filter[%s] cannot vectorize", getClass().getName()); } - /** - * Indicates whether this filter supports selectivity estimation. - * A filter supports selectivity estimation if it supports bitmap index and - * the dimension which the filter evaluates does not have multi values. - * - * @param columnSelector Object to check the dimension has multi values. - * @param indexSelector Object used to retrieve bitmap indexes - * - * @return true if this Filter supports selectivity estimation, false otherwise. - */ - boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector); - /** * Returns true if this filter can produce a vectorized matcher from its "makeVectorMatcher" method. * @param inspector Supplies type information for the selectors this filter will match against diff --git a/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java b/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java index 329e652ce0bb..cc421fa87bc5 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java @@ -54,7 +54,6 @@ import org.apache.druid.query.lookup.LookupExtractor; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.DimensionHandlerUtils; import org.apache.druid.segment.column.ColumnIndexSupplier; @@ -364,12 +363,6 @@ public Filter rewriteRequiredColumns(Map columnRewrites) } } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); - } - @Override public String toString() { diff --git a/processing/src/main/java/org/apache/druid/query/filter/NullFilter.java b/processing/src/main/java/org/apache/druid/query/filter/NullFilter.java index da737bdce890..00e13f7357f0 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/NullFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/NullFilter.java @@ -35,7 +35,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexSupplier; import org.apache.druid.segment.column.TypeSignature; @@ -158,12 +157,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) ).makeMatcher(NullPredicateFactory.INSTANCE); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, column, columnSelector, indexSelector); - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/query/filter/RangeFilter.java b/processing/src/main/java/org/apache/druid/query/filter/RangeFilter.java index 1e7f21e17c64..048fff191473 100644 --- a/processing/src/main/java/org/apache/druid/query/filter/RangeFilter.java +++ b/processing/src/main/java/org/apache/druid/query/filter/RangeFilter.java @@ -43,7 +43,6 @@ import org.apache.druid.query.ordering.StringComparators; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexSupplier; import org.apache.druid.segment.column.ColumnType; @@ -358,12 +357,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) ).makeMatcher(getPredicateFactory()); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, column, columnSelector, indexSelector); - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/query/search/ConciseBitmapDecisionHelper.java b/processing/src/main/java/org/apache/druid/query/search/ConciseBitmapDecisionHelper.java deleted file mode 100644 index 12c30374d5f0..000000000000 --- a/processing/src/main/java/org/apache/druid/query/search/ConciseBitmapDecisionHelper.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.druid.query.search; - -public class ConciseBitmapDecisionHelper extends SearchQueryDecisionHelper -{ - // This value comes from an experiment. - // See the discussion at https://github.com/apache/druid/pull/3792#issuecomment-268331804. - private static final double BITMAP_INTERSECT_COST = 7.425; - private static final ConciseBitmapDecisionHelper INSTANCE = new ConciseBitmapDecisionHelper(); - - public static ConciseBitmapDecisionHelper instance() - { - return INSTANCE; - } - - private ConciseBitmapDecisionHelper() - { - super(BITMAP_INTERSECT_COST); - } -} diff --git a/processing/src/main/java/org/apache/druid/query/search/RoaringBitmapDecisionHelper.java b/processing/src/main/java/org/apache/druid/query/search/RoaringBitmapDecisionHelper.java deleted file mode 100644 index 7d6ac5896d02..000000000000 --- a/processing/src/main/java/org/apache/druid/query/search/RoaringBitmapDecisionHelper.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.druid.query.search; - -public class RoaringBitmapDecisionHelper extends SearchQueryDecisionHelper -{ - // This value comes from an experiment. - // See the discussion at https://github.com/apache/druid/pull/3792#issuecomment-268331804. - private static final double BITMAP_INTERSECT_COST = 4.5; - private static final RoaringBitmapDecisionHelper INSTANCE = new RoaringBitmapDecisionHelper(); - - public static RoaringBitmapDecisionHelper instance() - { - return INSTANCE; - } - - private RoaringBitmapDecisionHelper() - { - super(BITMAP_INTERSECT_COST); - } -} diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchQueryDecisionHelper.java b/processing/src/main/java/org/apache/druid/query/search/SearchQueryDecisionHelper.java deleted file mode 100644 index fb68f9ae5789..000000000000 --- a/processing/src/main/java/org/apache/druid/query/search/SearchQueryDecisionHelper.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.druid.query.search; - -public abstract class SearchQueryDecisionHelper -{ - private final double bitmapIntersectCost; - - protected SearchQueryDecisionHelper(final double bitmapIntersectCost) - { - this.bitmapIntersectCost = bitmapIntersectCost; - } - - public double getBitmapIntersectCost() - { - return bitmapIntersectCost; - } -} diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchStrategy.java b/processing/src/main/java/org/apache/druid/query/search/SearchStrategy.java index 43ae15478434..9306301d13e3 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchStrategy.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchStrategy.java @@ -21,14 +21,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import org.apache.druid.collections.bitmap.BitmapFactory; -import org.apache.druid.collections.bitmap.ConciseBitmapFactory; -import org.apache.druid.collections.bitmap.RoaringBitmapFactory; import org.apache.druid.java.util.common.IAE; import org.apache.druid.query.Druids; import org.apache.druid.query.dimension.DimensionSpec; import org.apache.druid.query.filter.Filter; -import org.apache.druid.segment.QueryableIndex; import org.apache.druid.segment.Segment; import org.apache.druid.segment.data.Indexed; import org.apache.druid.segment.filter.Filters; @@ -53,18 +49,6 @@ protected SearchStrategy(SearchQuery query) public abstract List getExecutionPlan(SearchQuery query, Segment segment); - public SearchQueryDecisionHelper getDecisionHelper(QueryableIndex index) - { - final BitmapFactory bitmapFactory = index.getBitmapFactoryForDimensions(); - if (bitmapFactory.getClass().equals(ConciseBitmapFactory.class)) { - return ConciseBitmapDecisionHelper.instance(); - } else if (bitmapFactory.getClass().equals(RoaringBitmapFactory.class)) { - return RoaringBitmapDecisionHelper.instance(); - } else { - throw new IAE("Unknown bitmap type[%s]", bitmapFactory.getClass().getName()); - } - } - static List getDimsToSearch(Indexed availableDimensions, List dimensions) { if (dimensions == null || dimensions.isEmpty()) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java index 268bfdffb39c..493212ab8994 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/BoundFilter.java @@ -42,7 +42,6 @@ import org.apache.druid.query.ordering.StringComparators; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexCapabilities; import org.apache.druid.segment.column.ColumnIndexSupplier; @@ -216,12 +215,6 @@ public boolean canVectorizeMatcher(ColumnInspector inspector) return true; } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, boundDimFilter.getDimension(), columnSelector, indexSelector); - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java index 15fc13339a04..b36851d9330c 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ColumnComparisonFilter.java @@ -32,7 +32,6 @@ import org.apache.druid.segment.BaseObjectColumnValueSelector; import org.apache.druid.segment.ColumnProcessorFactory; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.DimensionSelector; import org.apache.druid.segment.column.ColumnCapabilities; @@ -141,12 +140,6 @@ public static boolean overlap(@Nullable String[] as, @Nullable String[] bs) return false; } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return false; - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java index f321691e033d..be10b7d33578 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/DimensionPredicateFilter.java @@ -37,7 +37,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.index.BitmapColumnIndex; import org.apache.druid.segment.vector.VectorColumnSelectorFactory; @@ -124,12 +123,6 @@ public Set getRequiredColumns() return ImmutableSet.of(dimension); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); - } - @Override public String toString() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java index 6c2acdcd2bca..c284c8e6bcef 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ExpressionFilter.java @@ -42,7 +42,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory; import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.ColumnValueSelector; import org.apache.druid.segment.column.ColumnCapabilities; @@ -231,15 +230,6 @@ public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) return null; } - @Override - public boolean supportsSelectivityEstimation( - final ColumnSelector columnSelector, - final ColumnIndexSelector indexSelector - ) - { - return false; - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java index c68fc2b9d476..2b432a73f594 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/FalseFilter.java @@ -24,7 +24,6 @@ import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.index.AllFalseBitmapColumnIndex; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -67,12 +66,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) return ConstantMatcherType.ALL_FALSE.asVectorMatcher(factory.getReadableVectorInspector()); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return true; - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java index d6ef5cb46ae2..f0ebce15ed74 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java @@ -34,9 +34,7 @@ import org.apache.druid.query.filter.FilterTuning; import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; -import org.apache.druid.segment.column.ColumnHolder; import org.apache.druid.segment.column.ColumnIndexSupplier; import org.apache.druid.segment.filter.cnf.CNFFilterExplosionException; import org.apache.druid.segment.filter.cnf.CalciteCnfHelper; @@ -157,22 +155,6 @@ public static ImmutableBitmap computeDefaultBitmapResults(Filter filter, ColumnI ); } - public static boolean supportsSelectivityEstimation( - Filter filter, - String dimension, - ColumnSelector columnSelector, - ColumnIndexSelector indexSelector - ) - { - if (filter.getBitmapColumnIndex(indexSelector) != null) { - final ColumnHolder columnHolder = columnSelector.getColumnHolder(dimension); - if (columnHolder != null) { - return columnHolder.getCapabilities().hasMultipleValues().isFalse(); - } - } - return false; - } - @Nullable public static Filter convertToCNFFromQueryContext(Query query, @Nullable Filter filter) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java index f00ac7a0f2ba..89eccb7055db 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/IsBooleanFilter.java @@ -31,7 +31,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexCapabilities; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -170,12 +169,6 @@ public Filter rewriteRequiredColumns(Map columnRewrites) return new IsBooleanFilter(baseFilter.rewriteRequiredColumns(columnRewrites), isTrue); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return baseFilter.supportsSelectivityEstimation(columnSelector, indexSelector); - } - @Override public String toString() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java index 05e357970cde..fc6440d83cc0 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/JavaScriptFilter.java @@ -25,7 +25,6 @@ import org.apache.druid.query.filter.FilterTuning; import org.apache.druid.query.filter.JavaScriptDimFilter; import org.apache.druid.query.filter.ValueMatcher; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -67,12 +66,6 @@ public ValueMatcher makeMatcher(ColumnSelectorFactory factory) return Filters.makeValueMatcher(factory, dimension, predicateFactory); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java index 6a4749693267..da20b4be30f5 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/LikeFilter.java @@ -32,7 +32,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexSupplier; import org.apache.druid.segment.index.AllTrueBitmapColumnIndex; @@ -166,12 +165,6 @@ public Filter rewriteRequiredColumns(Map columnRewrites) ); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); - } - /** * Returns true if this filter is a simple equals filter: dimension = 'value' with no extractionFn. */ diff --git a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java index 8d7fb39c2c06..1ef0e3c97f7a 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/NotFilter.java @@ -32,7 +32,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexCapabilities; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -163,12 +162,6 @@ public Filter rewriteRequiredColumns(Map columnRewrites) return new NotFilter(baseFilter.rewriteRequiredColumns(columnRewrites)); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return baseFilter.supportsSelectivityEstimation(columnSelector, indexSelector); - } - @Override public String toString() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java index a5307befb365..174375d80d3f 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/SelectorFilter.java @@ -31,7 +31,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory; import org.apache.druid.segment.ColumnInspector; import org.apache.druid.segment.ColumnProcessors; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexSupplier; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -125,12 +124,6 @@ public VectorValueMatcher makeVectorMatcher(final VectorColumnSelectorFactory fa ).makeMatcher(value); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return Filters.supportsSelectivityEstimation(this, dimension, columnSelector, indexSelector); - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java index 78dc5bf9126e..5d6405ac2710 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/SpatialFilter.java @@ -34,7 +34,6 @@ import org.apache.druid.query.filter.Filter; import org.apache.druid.query.filter.FilterTuning; import org.apache.druid.query.filter.ValueMatcher; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.column.ColumnIndexCapabilities; import org.apache.druid.segment.column.ColumnIndexSupplier; @@ -110,12 +109,6 @@ public ValueMatcher makeMatcher(ColumnSelectorFactory factory) ); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return false; - } - @Override public Set getRequiredColumns() { diff --git a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java index da0fb9f4a106..3dcf59ee47eb 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/TrueFilter.java @@ -24,7 +24,6 @@ import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.index.AllTrueBitmapColumnIndex; import org.apache.druid.segment.index.BitmapColumnIndex; @@ -70,12 +69,6 @@ public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) return ConstantMatcherType.ALL_TRUE.asVectorMatcher(factory.getReadableVectorInspector()); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return true; - } - @Override public boolean canVectorizeMatcher(ColumnInspector inspector) { diff --git a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java index bad6f4da41b5..add73b86b397 100644 --- a/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java +++ b/processing/src/test/java/org/apache/druid/query/search/SearchQueryRunnerWithCaseTest.java @@ -57,11 +57,14 @@ public class SearchQueryRunnerWithCaseTest extends InitializedNullHandlingTest @Parameterized.Parameters public static Iterable constructorFeeder() { - final SearchQueryConfig[] configs = new SearchQueryConfig[2]; + final SearchQueryConfig[] configs = new SearchQueryConfig[3]; configs[0] = new SearchQueryConfig(); configs[0].setSearchStrategy(UseIndexesStrategy.NAME); configs[1] = new SearchQueryConfig(); configs[1].setSearchStrategy(CursorOnlyStrategy.NAME); + // test auto to ensure that it doesn't explode + configs[2] = new SearchQueryConfig(); + configs[2].setSearchStrategy("auto"); CharSource input = CharSource.wrap( "2011-01-12T00:00:00.000Z\tspot\tAutoMotive\t1000\t10000.0\t10000.0\t100000\t10\t10.0\t10.0\tPREFERRED\ta\u0001preferred\t100.000000\n" + diff --git a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java index 43eb56fd850a..bb62f1249331 100644 --- a/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/filter/BaseFilterTest.java @@ -67,7 +67,6 @@ import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.segment.AutoTypeColumnSchema; import org.apache.druid.segment.ColumnInspector; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.Cursor; import org.apache.druid.segment.DimensionSelector; @@ -821,12 +820,6 @@ public ValueMatcher makeMatcher(ColumnSelectorFactory factory) return theFilter.makeMatcher(factory); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return false; - } - @Override public Set getRequiredColumns() { @@ -897,12 +890,6 @@ public Set getRequiredColumns() return null; } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return false; - } - @Nullable @Override public BitmapColumnIndex getBitmapColumnIndex(ColumnIndexSelector selector) diff --git a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java index 603c3ad866db..16613eae9715 100644 --- a/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java +++ b/processing/src/test/java/org/apache/druid/segment/incremental/IncrementalIndexStorageAdapterTest.java @@ -56,7 +56,6 @@ import org.apache.druid.query.topn.TopNQueryEngine; import org.apache.druid.query.topn.TopNResultValue; import org.apache.druid.segment.CloserRule; -import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.Cursor; import org.apache.druid.segment.DimensionSelector; @@ -649,12 +648,6 @@ public ValueMatcher makeMatcher(ColumnSelectorFactory factory) ); } - @Override - public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, ColumnIndexSelector indexSelector) - { - return true; - } - @Override public Set getRequiredColumns() {