@@ -98,15 +98,15 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
9898 && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .SORTED )) {
9999 return new SortedIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
100100 }
101+ if (RangeIndexBasedFilterOperator .canEvaluate (predicateEvaluator , dataSource )
102+ && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .RANGE )) {
103+ return new RangeIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
104+ }
101105 if (dataSource .getDataSourceMetadata ().isSorted () && dataSource .getDictionary () == null
102106 && dataSource .getDataSourceMetadata ().isSingleValue ()
103107 && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .SORTED )) {
104108 return new RawSortedIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
105109 }
106- if (RangeIndexBasedFilterOperator .canEvaluate (predicateEvaluator , dataSource )
107- && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .RANGE )) {
108- return new RangeIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
109- }
110110 return new ScanBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
111111 } else if (predicateType == Predicate .Type .REGEXP_LIKE ) {
112112 if (predicateEvaluator instanceof BaseDictIdBasedRegexpLikePredicateEvaluator ) {
@@ -125,11 +125,6 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
125125 && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .SORTED )) {
126126 return new SortedIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
127127 }
128- if (dataSource .getDataSourceMetadata ().isSorted () && dataSource .getDictionary () == null
129- && dataSource .getDataSourceMetadata ().isSingleValue ()
130- && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .SORTED )) {
131- return new RawSortedIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
132- }
133128 if (dataSource .getInvertedIndex () != null
134129 && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .INVERTED )) {
135130 // Use raw value inverted index filter operator for raw encoded columns
@@ -142,6 +137,11 @@ public BaseFilterOperator getLeafFilterOperator(QueryContext queryContext, Predi
142137 && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .RANGE )) {
143138 return new RangeIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
144139 }
140+ if (dataSource .getDataSourceMetadata ().isSorted () && dataSource .getDictionary () == null
141+ && dataSource .getDataSourceMetadata ().isSingleValue ()
142+ && queryContext .isIndexUseAllowed (dataSource , FieldConfig .IndexType .SORTED )) {
143+ return new RawSortedIndexBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
144+ }
145145 return new ScanBasedFilterOperator (queryContext , predicateEvaluator , dataSource , numDocs );
146146 }
147147 }
0 commit comments