clintropolis commented on a change in pull request #8209: add mechanism to 
control filter optimization in historical query processing
URL: https://github.com/apache/incubator-druid/pull/8209#discussion_r312215238
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/segment/filter/Filters.java
 ##########
 @@ -654,27 +654,29 @@ private static void generateAllCombinations(
   }
 
   /**
-   * This method provides a "standard" implementation of {@link 
Filter#shouldUseIndex(BitmapIndexSelector)} which takes
+   * This method provides a "standard" implementation of {@link 
Filter#shouldUseBitmapIndex(BitmapIndexSelector)} which takes
    * a {@link Filter}, a {@link BitmapIndexSelector}, and {@link FilterTuning} 
to determine if:
-   *  a) the filter supports bitmap indexes
+   *  a) the filter supports bitmap indexes for all required columns
    *  b) the filter tuning specifies that it should use the index
    *  c) the cardinality of the column is above the minimum threshold and 
below the maximum threshold to use the index
    *
    * If all these things are true, {@link 
org.apache.druid.segment.QueryableIndexStorageAdapter} will utilize the
    * indexes.
    */
-  public static boolean shouldUseIndex(
+  public static boolean shouldUseBitmapIndex(
       Filter filter,
       BitmapIndexSelector indexSelector,
       @Nullable FilterTuning filterTuning
   )
   {
     final FilterTuning tuning = filterTuning != null ? filterTuning : 
FilterTuning.createDefault(filter, indexSelector);
-    if (filter.supportsBitmapIndex(indexSelector) && tuning.getUseIndex()) {
+    if (filter.supportsBitmapIndex(indexSelector) && 
tuning.getUseBitmapIndex()) {
       return filter.getRequiredColumns().stream().allMatch(column -> {
-        final int cardinality = 
indexSelector.getBitmapIndex(column).getCardinality();
-        return cardinality >= tuning.getUseIndexMinCardinalityThreshold()
-               && cardinality <= tuning.getUseIndexMaxCardinalityThreshold();
+        final BitmapIndex index = indexSelector.getBitmapIndex(column);
+        Preconditions.checkNotNull(index, "WTF?! column doesn't have a bitmap 
index");
 
 Review comment:
   changed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to