This is an automated email from the ASF dual-hosted git repository.

ming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new d376b02dc fix HBase PrefixFilter bug (#2364)
d376b02dc is described below

commit d376b02dc552dfbfcc32937aef684436196bc511
Author: haohao0103 <[email protected]>
AuthorDate: Wed Nov 29 19:11:28 2023 +0800

    fix HBase PrefixFilter bug (#2364)
    
    * #2177
    
    * #2177
    
    * #2177
    
    * #2177
    
    * #2177
    
    * #2177
---
 .../apache/hugegraph/backend/store/hbase/HbaseSessions.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
 
b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
index 06cbf9ab7..6f0bf3714 100644
--- 
a/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
+++ 
b/hugegraph-server/hugegraph-hbase/src/main/java/org/apache/hugegraph/backend/store/hbase/HbaseSessions.java
@@ -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);
         }
 

Reply via email to