You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "tkhurana (via GitHub)" <gi...@apache.org> on 2025/10/02 21:51:13 UTC

[PR] PHOENIX-7707 Phoenix server paging on valid rows [phoenix]

tkhurana opened a new pull request, #2294:
URL: https://github.com/apache/phoenix/pull/2294

   (no comment)


-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7707 Phoenix server paging on valid rows [phoenix]

Posted by "kadirozde (via GitHub)" <gi...@apache.org>.
kadirozde commented on code in PR #2294:
URL: https://github.com/apache/phoenix/pull/2294#discussion_r2408520629


##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerPagingIT.java:
##########
@@ -262,6 +269,210 @@ public void testOrderByNonAggregation() throws Exception {
         assertEquals(D2.getTime(), rs.getDate(1).getTime());
         assertFalse(rs.next());
         assertServerPagingMetric(tablename, rs, true);
+        Map<String, Map<MetricType, Long>> metrics = PhoenixRuntime.getRequestReadMetricInfo(rs);
+        long numRows = getMetricValue(metrics, MetricType.COUNT_ROWS_SCANNED);
+        assertEquals(6, numRows);
+        long numRpcs = getMetricValue(metrics, MetricType.COUNT_RPC_CALLS);
+        // 3 regions * (2 rows per region + 1 scanner open with page timeout set to 0 ms)
+        assertEquals(9, numRpcs);
+      }
+    }
+  }
+
+  @Test
+  public void testMultiKeyPointLookup() throws Exception {
+    final String tablename = generateUniqueName();
+    Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+    // use a higher timeout value so that we can trigger a page timeout from the scanner
+    // rather than the page filter
+    props.put(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, Long.toString(5));
+    String ddl = String.format("CREATE TABLE %s (id VARCHAR NOT NULL, k1 INTEGER NOT NULL, "
+      + "k2 INTEGER NOT NULL, k3 INTEGER, v1 VARCHAR CONSTRAINT pk PRIMARY KEY (id, k1, k2)) "
+      + "\"%s\" = true", tablename, USE_BLOOMFILTER_FOR_MULTIKEY_POINTLOOKUP);
+    try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
+      conn.createStatement().execute(ddl);
+      String dml = "UPSERT INTO " + tablename + " VALUES(?, ?, ?, ?, ?)";
+      PreparedStatement ps = conn.prepareStatement(dml);
+      int totalRows = 10000;
+      for (int i = 0; i < totalRows; ++i) {
+        ps.setString(1, "id_" + i % 3);
+        ps.setInt(2, i % 20);
+        ps.setInt(3, i);
+        ps.setInt(4, i % 10);
+        ps.setString(5, "val");
+        ps.executeUpdate();
+        if (i != 0 && i % 100 == 0) {
+          conn.commit();
+        }
+      }
+      conn.commit();
+      int rowKeyCount = 1000;
+      List<String> inList =
+        Stream.generate(() -> "(?, ?, ?)").limit(rowKeyCount).collect(Collectors.toList());
+      String dql = String.format("select id, k1, k2 from %s where (id, k1, k2) IN (%s)", tablename,
+        String.join(",", inList));
+      ps = conn.prepareStatement(dql);
+      int expectedValidRows = 0;
+      for (int i = 0; i < rowKeyCount; i++) {
+        ps.setString(3 * i + 1, "id_" + i % 3);
+        if (RAND.nextBoolean()) {
+          ++expectedValidRows;
+          ps.setInt(3 * i + 2, i % 20);
+        } else {
+          // generate a non-existing row key
+          ps.setInt(3 * i + 2, 78123);
+        }
+        ps.setInt(3 * i + 3, i);
+      }
+      int actualValidRows = 0;
+      try (ResultSet rs = ps.executeQuery()) {
+        while (rs.next()) {
+          ++actualValidRows;
+        }
+        assertEquals(expectedValidRows, actualValidRows);
+        Map<String, Map<MetricType, Long>> metrics = PhoenixRuntime.getRequestReadMetricInfo(rs);
+        long numRows = getMetricValue(metrics, MetricType.COUNT_ROWS_SCANNED);
+        assertEquals(expectedValidRows, numRows);
+        long numRpcs = getMetricValue(metrics, MetricType.COUNT_RPC_CALLS);
+        assertTrue(numRpcs > 1);

Review Comment:
   Assuming that HBase will return at most 100 rows per RPC, should this be `assertTrue(numRpcs > Math.ceil(numRows / (double) 100));`?



-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7707 Phoenix server paging on valid rows [phoenix]

Posted by "tkhurana (via GitHub)" <gi...@apache.org>.
tkhurana merged PR #2294:
URL: https://github.com/apache/phoenix/pull/2294


-- 
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: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org