Skip to content

Commit

Permalink
handle scan with filter
Browse files Browse the repository at this point in the history
  • Loading branch information
terence-yoo committed Dec 26, 2024
1 parent c84290c commit 8075b0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private MatchCode checkDeletedEffectively(ExtendedCell cell, ExtendedCell prevCe

private boolean canOptimizeReadDeleteMarkers(boolean visibilityLabelEnabled) {
// for simplicity, optimization works only for these cases
return !seePastDeleteMarkers && scanMaxVersions == 1 && !visibilityLabelEnabled;
return !seePastDeleteMarkers && scanMaxVersions == 1 && !visibilityLabelEnabled
&& getFilter() == null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hadoop.hbase.KeepDeletedCells;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.Type;
import org.apache.hadoop.hbase.filter.FilterList;
import org.apache.hadoop.hbase.regionserver.ScanInfo;
import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher.MatchCode;
import org.apache.hadoop.hbase.security.visibility.VisibilityUtils;
Expand Down Expand Up @@ -268,4 +269,12 @@ public void testDeleteFamilyWithVisibilityLabelEnabled() throws IOException {
pairs.add(new Pair<>(createKV(col1, 1, Type.Put), MatchCode.SEEK_NEXT_COL));
verify(pairs, 1, VisibilityUtils.isVisibilityLabelEnabled(conf));
}

@Test
public void testScanWithFilter() throws IOException {
scan.setFilter(new FilterList());
pairs.add(new Pair<>(createKV(null, 2, Type.DeleteFamily), MatchCode.SKIP));
pairs.add(new Pair<>(createKV(col1, 1, Type.Put), MatchCode.SEEK_NEXT_COL));
verify(pairs);
}
}

0 comments on commit 8075b0d

Please sign in to comment.