Apache9 commented on code in PR #5955:
URL: https://github.com/apache/hbase/pull/5955#discussion_r1625331610


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithAND.java:
##########
@@ -206,17 +244,28 @@ public boolean filterRowKey(Cell firstRowCell) throws 
IOException {
     if (isEmpty()) {
       return super.filterRowKey(firstRowCell);
     }
-    boolean retVal = false;
+    boolean anyRowKeyFiltered = false;
+    boolean anyHintingPassed = false;
     for (int i = 0, n = filters.size(); i < n; i++) {
       Filter filter = filters.get(i);
-      if (filter.filterAllRemaining() || filter.filterRowKey(firstRowCell)) {
+      if (filter.filterAllRemaining()) {
+        // We don't need to care about any later filters, as we end the scan 
immediately.
+        // TODO PHOENIX-7322 in the normal code path, filterAllRemaining() 
always gets checked
+        // before filterRowKey(). We should be able to remove this check.
+        return true;
+      } else if (filter.filterRowKey(firstRowCell)) {
         // Can't just return true here, because there are some filters (such 
as PrefixFilter) which
         // will catch the row changed event by filterRowKey(). If we return 
early here, those
         // filters will have no chance to update their row state.
-        retVal = true;
+        anyRowKeyFiltered = true;
+      } else if (hintingFilters[i]) {
+        // If a hinting filters has returned false, then we must not filter 
this rowkey.
+        // Otherwise this sub-filter doesn't get a chance to provide a seek 
hint, and the scan may
+        // regress into a full scan.
+        anyHintingPassed = true;
       }
     }
-    return retVal;
+    return anyRowKeyFiltered && !anyHintingPassed;

Review Comment:
   I do not understand.
   
   The hintingFilters array just stores whether the filter in the filter list 
is a HintingFilter, it does not mean the HintingFilter returns false?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to