Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
return new MatchAllFilterOperator(numDocs);
}

// Currently sorted index based filtering is supported only for
// dictionary encoded columns. The on-disk segment metadata
// will indicate if the column is sorted or not regardless of
// whether it is raw or dictionary encoded. Here when creating
// the filter operator, we need to make sure that sort filter
// operator is used only if the column is sorted and has dictionary.
// Sorted index based filtering is supported for both dictionary encoded and raw columns.
// For dictionary encoded sorted columns, SortedIndexBasedFilterOperator uses the sorted
// index reader. For raw sorted columns, RawSortedIndexBasedFilterOperator uses binary
// search on the forward index.
Predicate.Type predicateType = predicateEvaluator.getPredicateType();
if (predicateType == Predicate.Type.RANGE) {
if (dataSource.getDataSourceMetadata().isSorted() && dataSource.getDictionary() != null
Expand All @@ -104,6 +102,11 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
&& queryContext.isIndexUseAllowed(dataSource, FieldConfig.IndexType.RANGE)) {
return new RangeIndexBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
}
if (dataSource.getDataSourceMetadata().isSorted() && dataSource.getDictionary() == null
&& dataSource.getDataSourceMetadata().isSingleValue()
&& queryContext.isIndexUseAllowed(dataSource, FieldConfig.IndexType.SORTED)) {
return new RawSortedIndexBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is duplicated with line 140

return new ScanBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
} else if (predicateType == Predicate.Type.REGEXP_LIKE) {
if (predicateEvaluator instanceof BaseDictIdBasedRegexpLikePredicateEvaluator) {
Expand Down Expand Up @@ -134,6 +137,11 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
&& queryContext.isIndexUseAllowed(dataSource, FieldConfig.IndexType.RANGE)) {
return new RangeIndexBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
}
if (dataSource.getDataSourceMetadata().isSorted() && dataSource.getDictionary() == null
&& dataSource.getDataSourceMetadata().isSingleValue()
&& queryContext.isIndexUseAllowed(dataSource, FieldConfig.IndexType.SORTED)) {
return new RawSortedIndexBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
}
return new ScanBasedFilterOperator(queryContext, predicateEvaluator, dataSource, numDocs);
}
}
Expand Down Expand Up @@ -221,7 +229,8 @@ int getPriority(BaseFilterOperator filterOperator) {
return priority.getAsInt();
}
}
if (filterOperator instanceof SortedIndexBasedFilterOperator) {
if (filterOperator instanceof SortedIndexBasedFilterOperator
|| filterOperator instanceof RawSortedIndexBasedFilterOperator) {
return PrioritizedFilterOperator.HIGH_PRIORITY;
}
if (filterOperator instanceof BitmapBasedFilterOperator
Expand Down
Loading
Loading