fix HBase PrefixFilter bug (#2364)

* #2177

* #2177

* #2177

* #2177

* #2177

* #2177
This commit is contained in:
haohao0103 2023-11-29 19:11:28 +08:00 committed by GitHub
parent 197e8a00ed
commit d376b02dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -415,11 +415,18 @@ public class HbaseSessions extends BackendSessionPool {
/**
* Scan records by rowkey start and prefix from a table
* TODO: setRowPrefixFilter deprecated since HBase 2.5.0, will be removed in 4.0.0,
* use setStartStopRowForPrefixScan(byte[]) instead.
*/
default R scan(String table, byte[] startRow, boolean inclusiveStart,
byte[] prefix) {
Scan scan = new Scan().withStartRow(startRow, inclusiveStart)
.setFilter(new PrefixFilter(prefix));
final Scan scan = new Scan();
if(startRow == prefix) {
scan.setRowPrefixFilter(prefix);
} else {
scan.withStartRow(startRow, inclusiveStart)
.setFilter(new PrefixFilter(prefix));
}
return this.scan(table, scan);
}