Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mechanism to control filter optimization in historical query processing #8209

Merged
merged 26 commits into from
Aug 9, 2019

Conversation

clintropolis
Copy link
Member

@clintropolis clintropolis commented Jul 31, 2019

Description

This PR introduces the ability for most DimFilter implementations to control whether or not QueryableIndexStorageAdapter will use a bitmap index while processing queries. I consider this to be laying the groundwork for allowing QueryableIndexStorageAdapter the opportunity for more sophisticated decision making when deciding when to use bitmap indexes or not, but the first step of this is to enable easy experimentation so that we can shake out what good "automatic" decisions might be.

This PR is related to #3878, and replaces #6633, which was a more targeted attempt at something similar.

This is done by adding a new type, FilterTuning, which most DimFilter implementations will accept if specified in the filter json, which is supplied to all Filter implementations. The Filter interface itself has been modified with a few new methods:

  • getRequiredColumns which is analog to DimFilter.getRequiredColumns
  • shouldUseIndex which QueryableIndexStorageAdapter and FilteringOffset call now instead of supportsBitmapIndex directly, to determine if a bitmap index should be used.

And a static default implementation of supportsBitmapIndex supplied by Filters that currently all Filter implementations are using.

FilterTuning currently has 3 properties:

property type description default
useIndex boolean allow manually skipping bitmap index even if it exists true
maxCardinalityToUseBitmapIndex integer allow using a bitmap index only if cardinality is under max value Integer.MAX_VALUE
minCardinalityToUseBitmapIndex integer allow using bitmap index only if cardinality is over min value (this is probably useless, but i wanted levers to pull to see what happens). 0

Since this is an advanced feature intended primarily for experimentation, I am leaving it undocumented for now.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added unit tests or modified existing tests to cover new code paths.

For reviewers: the key changed/added classes in this PR

  • Filter
  • QueryableIndexStorageAdapter
  • FilterTuning
  • FilterPartitionTest

@gianm
Copy link
Contributor

gianm commented Aug 2, 2019

the first step of this is to enable easy experimentation so that we can shake out what good "automatic" decisions might be.

👍

Since this is an advanced feature intended primarily for experimentation, I am leaving it undocumented for now.

I haven't read through the patch yet, so if it's not already, could you make sure this is in the javadoc for the major classes involved (probably just FilterTuning)? Something like: intentionally undocumented in user-facing docs because at this time the feature is meant for experimentation. And a comment that we'd like to document this (or whatever it turns into) in a future release.


@JsonCreator
public BloomDimFilter(
@JsonProperty("dimension") String dimension,
@JsonProperty("bloomKFilter") BloomKFilterHolder bloomKFilterHolder,
@JsonProperty("extractionFn") ExtractionFn extractionFn
@JsonProperty("extractionFn") ExtractionFn extractionFn,
@JsonProperty("filterTuning") FilterTuning filterTuning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you missing a @JsonProperty getter for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added (also a couple of other missing this)

@@ -48,4 +50,20 @@ ValueMatcher makeMatcher(
ColumnSelectorFactory columnSelectorFactory,
RowOffsetMatcherFactory rowOffsetMatcherFactory
);

@Override
default FilterTuning getManualTuning()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please annotate with @Nullable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed entirely

return new FilterTuning(useIndex, 0, Integer.MAX_VALUE);
}

private final Boolean useIndex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mark these @Nullable too, just like the constructor parameters.

Or, apply the defaults you have in getUseIndex(), etc, in the constructors and make these fields primitives.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied defaults in constructor

@@ -152,6 +171,12 @@ public StringComparator getOrdering()
return ordering;
}

@JsonProperty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include @JsonInclude(JsonInclude.Include.NON_NULL) here, and in all other places FilterTuning appears as a json property, to avoid polluting jsonifications of filters with this experimental feature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to DimFilter getters


/**
* "Manual" {@link FilterTuning} to allow explicit control of filter optimization behavior. This will likely be
* supplied by the {@link DimFilter} that is creating this {@link Filter}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended that anything outside of computeTuning call this method? If not, please update the javadocs to tell people not to call it. Maybe mention that you would have made it protected, except that Filter is an interface, so you can't do that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method has been removed

FilterTuning getManualTuning();

/**
* This method allows a filter to automatically compute a {@link FilterTuning} based on information it can gather
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment to computeTuning, it seems like this might only be called by shouldUseIndex.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, what do you think about not having getManualTuning and computeTuning, and instead having a static function in Filters that provides a useful default impl for shouldUseIndex? So most Filters would do something like:

@Override
boolean shouldUseIndex(BitmapIndexSelector selector)
{
  return Filters.shouldUseIndex(this, selector, filterTuning);
}

It's not really more work or lines of code than overriding getManualTuning, which they'd have to do anyway with the current design. And it cuts 3 interface methods down to 1.

It would also be less spooky in terms of action-at-a-distance. It's nice to have methods defined in concrete classes rather than inherited from supertypes, since it makes it clearer to readers of the one class what is going on (without having to flip around as much between concrete impl and supertype).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, I think the current structure is a an artifact of my original version of this where the work was done by QueryableIndexStorageAdapter, will refactor

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@JsonProperty
public Boolean getUseIndex()
{
return useIndex != null ? useIndex : true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'll never be null, so it'd be better to return a primitive.

Same comment for the other two methods.

this.intervalLongs = makeIntervalLongs();
this.convertedFilter = new OrDimFilter(makeBoundDimFilters());
}

@VisibleForTesting
public IntervalDimFilter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I assume you left the old constructors in to avoid a bunch of test churn. I think that's fine but could you please double check that they aren't being used in production code? (You got the one in InDimFilter.optimize that I was thinking of when I wrote this, but there are potentially others)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were a few being created in calcite stuff, adjusted them to set null for tuning.


public class BoundFilter implements Filter
{
private final BoundDimFilter boundDimFilter;
private final Comparator<String> comparator;
private final ExtractionFn extractionFn;
private final FilterTuning manualFilterTuning;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes the field is called manualFilterTuning and sometimes it's called filterTuning. Could you please pick one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it is consistently called filterTuning on DimFilter and manualFilterTuning on Filter implementations. This distinction is because everything in DimFilter is manual since it was provided by the json query, where as this is explictly the user set value on Filter implementations that was supplied by the DimFilter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed all to filterTuning

@Override
public Set<String> getRequiredColumns()
{
return dimensions.stream().map(dim -> dim.getDimension()).collect(Collectors.toSet());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map(DimensionSpec::getDimension)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@leventov leventov self-requested a review August 3, 2019 09:04
@gianm
Copy link
Contributor

gianm commented Aug 4, 2019

The CI issues look legit, seems like some tests don't compile?

Oh wait, sorry, my browser had an old version cached. Nevermind.

Copy link
Member

@leventov leventov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed until ExpressionDimFilter.java

@@ -42,12 +45,14 @@
private final BloomKFilter bloomKFilter;
private final HashCode hash;
private final ExtractionFn extractionFn;
private final FilterTuning filterTuning;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be @Nullable, along with the corresponding constructor parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've updated all DimFilter implementations to have the appropriate things annotated with @Nullable

@@ -174,6 +191,13 @@ public ExtractionFn getExtractionFn()
return extractionFn;
}

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty
public FilterTuning getFilterTuning()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be @Nullable

BloomDimFilter that = (BloomDimFilter) o;
return dimension.equals(that.dimension) &&
hash.equals(that.hash) &&
Objects.equals(extractionFn, that.extractionFn) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything about extractionFn: the field, constructor parameter, getter should be @Nullable

@@ -100,7 +100,8 @@ public DimFilter toDruidFilter(
return new BloomDimFilter(
druidExpression.getSimpleExtraction().getColumn(),
holder,
druidExpression.getSimpleExtraction().getExtractionFn()
druidExpression.getSimpleExtraction().getExtractionFn(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructor annotated @VisibleForTesting doesn't mean it can't be used in production code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is true, but I was trying to avoid using these constructors in production code to minimize the chance of errors and make things more obvious.

I initially had it more like you are suggesting and was using some of the 'test' constructors where we were always passing null, but this comment suggested the way it is now and I agree, I think the production code explicitly passing in null for the filterTuning parameter makes it less ambiguous about if not having a tuning is intentional or not, without requiring a comment.

Copy link
Member

@leventov leventov Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's anyway strange that there is a chaining constructor and any code is not using an existing constructor with fewer parameters.

I think it would be better to create static factory methods in this situation. Some of them may have "InTest" suffix to strongly indicate that they are not for prod code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but the reason I have a second set of constructors at all was so I didn't have to change hundreds of lines of test code to add a null parameter, so making a static method would sort of defeat the purpose of that because the lines would change anyway.

I do think this is worth doing, I'll add this to the ticket i create about refactoring DimFilter to also add useful test filter creation static methods, so we can also eliminate passing in null everywhere for filters without extractionFn.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioned making static test object creators to decouple test filters from json schema in #8256

@@ -114,6 +115,7 @@ public DimFilter toDruidFilter(
return new BloomDimFilter(
virtualColumn.getOutputName(),
holder,
null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

@@ -40,14 +43,25 @@
private static final Joiner COMMA_JOINER = Joiner.on(", ");

private final List<DimensionSpec> dimensions;
private final FilterTuning filterTuning;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please annotate with @Nullable everything that is needed in this class.

@@ -204,7 +204,7 @@ public TimeseriesQueryBuilder filters(String dimensionName, String value)

public TimeseriesQueryBuilder filters(String dimensionName, String value, String... values)
{
dimFilter = new InDimFilter(dimensionName, Lists.asList(value, values), null);
dimFilter = new InDimFilter(dimensionName, Lists.asList(value, values), null, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could call the old constructor

@@ -361,7 +361,7 @@ public SearchQueryBuilder dataSource(DataSource d)

public SearchQueryBuilder filters(String dimensionName, String value)
{
dimFilter = new SelectorDimFilter(dimensionName, value, null);
dimFilter = new SelectorDimFilter(dimensionName, value, null, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could call the old constructor


@VisibleForTesting
public BloomDimFilter(
String dimension,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary wrapping, also in many other newly added constructors below in this PR

@@ -39,23 +41,42 @@
{
private final String expression;
private final Supplier<Expr> parsed;
private final FilterTuning filterTuning;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please annotate with @Nullable everything that is needed in this class.

Copy link
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small comments about some of the new javadocs. The rest LGTM.

} else {
return StringUtils.format("%s = %s", dimension, hash.toString());
}
return new DimFilterToStringBuilder().appendDimension(dimension, extractionFn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa. This is cool.

* used. This method, by default, will consider a {@link FilterTuning} to make decisions about when to use an
* available index. Override this method in a {@link Filter} implementation when {@link FilterTuning} alone is not
* adequate for making this decision.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reword slightly. This method doesn't do anything by default anymore (it did in an earlier version). Maybe cut the last two sentences, and replace with:

Implementations of this methods typically consider a {@link FilterTuning} to make decisions about when to use an available index.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, forgot about this, will fix this and add javadoc for Filters.shouldUseIndex and maybe link this one to that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, these new ones look good to me.

@@ -651,4 +652,17 @@ private static void generateAllCombinations(
generateAllCombinations(result, andList.subList(1, andList.size()), nonAndList);
}
}

public static boolean shouldUseIndex(Filter filter, BitmapIndexSelector indexSelector, FilterTuning filterTuning)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a bit of javadocs as to its purpose ("standard" implementation of Filter.shouldUseIndex) and how it works (returns true if the filter supports indexes and if all underlying columns match the thresholds in filterTuning). Also that filterTuning is nullable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good. Marking the filterTuning parameter @Nullable would be helpful too.

Copy link
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -651,4 +652,17 @@ private static void generateAllCombinations(
generateAllCombinations(result, andList.subList(1, andList.size()), nonAndList);
}
}

public static boolean shouldUseIndex(Filter filter, BitmapIndexSelector indexSelector, FilterTuning filterTuning)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good. Marking the filterTuning parameter @Nullable would be helpful too.

/**
* Append dimension name OR {@link ExtractionFn#toString()} with dimension wrapped in parenthesis
*/
DimFilterToStringBuilder appendDimension(String dimension, ExtractionFn extractionFn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extractionFn should be @Nullable

/**
* Add filter tuning to {@link #builder} if tuning exists
*/
DimFilterToStringBuilder appendFilterTuning(FilterTuning tuning)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tuning should be @Nullable

extractionFn,
ordering,
filterTuning
);
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this refactoring

@@ -73,7 +78,8 @@
public InDimFilter(
@JsonProperty("dimension") String dimension,
@JsonProperty("values") Collection<String> values,
@JsonProperty("extractionFn") ExtractionFn extractionFn
@Nullable @JsonProperty("extractionFn") ExtractionFn extractionFn,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: I think it's more semantic to put @Nullable immediately before the type so that @Nullable ExtractionFn is the "extended type" of the variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, done to all occurrences I found in the codebase

* Determine if a filter *should* use a bitmap index based on information collected from the supplied
* {@link BitmapIndexSelector}. This method differs from {@link #supportsBitmapIndex(BitmapIndexSelector)} in that
* the former only indicates if a bitmap index is available and {@link #getBitmapIndex(BitmapIndexSelector)} may be
* used. Implementations of this methods typically consider a {@link FilterTuning} to make decisions about when to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the sentence "Implementations of this methods...", please add

*
* If shouldUseFilter(selector) returns true, {@link #supportsBitmapIndex} must also return true when called with the
* same selector object.
*

as a separate paragraph.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


/**
*/
public class SpatialDimFilter implements DimFilter
{
private final String dimension;
private final Bound bound;
@Nullable
private final FilterTuning filterTuning;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is significant repetition between all these Filter implementations. Did you research if there is a way to cross-cut the things, e. g. by somehow providing filterTuning externally, so that each Filter doesn't have to have it as a field? Or, maybe an abstract superclass could be extracted?

Same applies to extractionFn.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree here. Doing it externally seemed difficult because I wanted it to be per filter, but I did heavily consider making some sort of abstract class on top of DimFilter to handle extractionFn and filterTuning, but I think at this point would prefer to do as a follow-up so I will open an issue soon about refactoring DimFilter, and potentially merging Filter and DimFilter as well since there isn't a good reason for them to be split.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #8256

@@ -56,7 +56,7 @@
rowOffsetMatcherFactory
);
} else {
if (postFilter.supportsBitmapIndex(bitmapIndexSelector)) {
if (postFilter.shouldUseIndex(bitmapIndexSelector)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use consistent naming: either "supportsBitmapIndex" and "shouldUseBitmapIndex", or both names without "Bitmap" part.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to shouldUseBitmapIndex

@@ -125,6 +125,17 @@ public boolean canVectorizeMatcher()
return filters.stream().allMatch(Filter::canVectorizeMatcher);
}

@Override
public boolean shouldUseIndex(BitmapIndexSelector bitmapIndexSelector)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since shouldUseIndex related to supportsBitmapIndex and their implementations look similar, please keep them adjacent in code. It makes easier to visually validate that there are no bugs like forgetting !.

Same applies to all other classes where shouldUseIndex is implemented, and to the definition of this method in Filter interface itself.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Override
public Set<String> getRequiredColumns()
{
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.emptySet()

@Override
public Set<String> getRequiredColumns()
{
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.emptySet()

@@ -127,7 +130,8 @@ public static BoundDimFilter equalTo(final BoundRefKey boundRefKey, final String
false,
null,
boundRefKey.getExtractionFn(),
boundRefKey.getComparator()
boundRefKey.getComparator(),
null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space

}

private final boolean useIndex;
private final int useIndexMinCardinalityThreshold;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's that important here to use the same prefix for all three fields. It's not very clear what does "useIndexMinCardinalityThreshold" mean. My suggestion is "minBitmapIndexCardinalityToUse".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to minCardinalityToUseBitmapIndex

return new FilterTuning(filter.supportsBitmapIndex(selector), null, null);
}

private final boolean useIndex;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to rename Filter.shouldUseIndex() to shouldUseBitmapIndex then this field should be renamed, too, for total consistency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

* Indicates whether this filter can return a bitmap index for filtering, based on
* the information provided by the input BitmapIndexSelector.
* Indicates whether this filter can return a bitmap index for filtering, based on the information provided by the
* input BitmapIndexSelector.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap BitmapIndexSelector with {@link }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{
return Filters.shouldUseIndex(this, bitmapIndexSelector, filterTuning);
return Filters.shouldUseBitmapIndex(this, selector, filterTuning);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's confusing that this method doesn't just return false while supportsBitmapIndex() does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, changed

return cardinality >= tuning.getUseIndexMinCardinalityThreshold()
&& cardinality <= tuning.getUseIndexMaxCardinalityThreshold();
final BitmapIndex index = indexSelector.getBitmapIndex(column);
Preconditions.checkNotNull(index, "WTF?! column doesn't have a bitmap index");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest not to use "WTF" from now on in the project. See also #8269.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@clintropolis clintropolis merged commit 1054d85 into apache:master Aug 9, 2019
@clintropolis clintropolis deleted the filter-tuning branch August 9, 2019 23:36
@clintropolis clintropolis added this to the 0.16.0 milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants