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

vjasani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new d6278a0f70 PHOENIX-6900 Enable paging feature when the phoenix query 
is made on a table snapshot. (#1673)
d6278a0f70 is described below

commit d6278a0f7008a70240eebcd24833b0281d71d831
Author: sdave33 <127544319+sdav...@users.noreply.github.com>
AuthorDate: Thu Sep 21 12:06:39 2023 +0530

    PHOENIX-6900 Enable paging feature when the phoenix query is made on a 
table snapshot. (#1673)
---
 .../org/apache/phoenix/iterate/TableSnapshotResultIterator.java  | 2 ++
 phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableSnapshotResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableSnapshotResultIterator.java
index d170006698..8797e19059 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableSnapshotResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableSnapshotResultIterator.java
@@ -42,6 +42,7 @@ import org.apache.phoenix.compile.StatementContext;
 import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.monitoring.ScanMetricsHolder;
 import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.util.ScanUtil;
 import org.apache.phoenix.util.ServerUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -133,6 +134,7 @@ public class TableSnapshotResultIterator implements 
ResultIterator {
       }
     }
     this.regions.sort(RegionInfo.COMPARATOR);
+    ScanUtil.setScanAttributeForPaging(scan, this.context.getConnection());
     LOGGER.info("Initialization complete with " + regions.size() + " valid 
regions");
   }
 
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
index d10fc7246c..22e1a03bb6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ScanUtil.java
@@ -1289,20 +1289,25 @@ public class ScanUtil {
             
scan.setAttribute(BaseScannerRegionObserver.EMPTY_COLUMN_QUALIFIER_NAME, 
emptyCQ);
             addEmptyColumnToScan(scan, emptyCF, emptyCQ);
         }
+
+        setScanAttributeForPaging(scan, phoenixConnection);
+    }
+
+    public static void setScanAttributeForPaging(Scan scan, PhoenixConnection 
phoenixConnection) {
         if (phoenixConnection.getQueryServices().getProps().getBoolean(
                 QueryServices.PHOENIX_SERVER_PAGING_ENABLED_ATTRIB,
                 QueryServicesOptions.DEFAULT_PHOENIX_SERVER_PAGING_ENABLED)) {
             long pageSizeMs = phoenixConnection.getQueryServices().getProps()
                     .getInt(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, -1);
             if (pageSizeMs == -1) {
-                // Use the half of the HBase RPC timeout value as the the 
server page size to make sure that the HBase
+                // Use the half of the HBase RPC timeout value as the server 
page size to make sure that the HBase
                 // region server will be able to send a heartbeat message to 
the client before the client times out
                 pageSizeMs = (long) 
(phoenixConnection.getQueryServices().getProps()
                         .getLong(HConstants.HBASE_RPC_TIMEOUT_KEY, 
HConstants.DEFAULT_HBASE_RPC_TIMEOUT) * 0.5);
             }
+
             scan.setAttribute(BaseScannerRegionObserver.SERVER_PAGE_SIZE_MS, 
Bytes.toBytes(Long.valueOf(pageSizeMs)));
         }
-
     }
 
     public static void getDummyResult(byte[] rowKey, List<Cell> result) {

Reply via email to