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

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


The following commit(s) were added to refs/heads/main by this push:
     new 9ad2f9b  Additional tests for sparse index using UpdateItem
9ad2f9b is described below

commit 9ad2f9b562329a92b9582e51f4197209c6c5d233
Author: Viraj Jasani <[email protected]>
AuthorDate: Thu Nov 20 07:52:28 2025 -0800

    Additional tests for sparse index using UpdateItem
---
 .../java/org/apache/phoenix/ddb/ScanIndex3IT.java  | 28 +++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git 
a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java 
b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
index ad584a4..c66b988 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
@@ -46,6 +46,7 @@ import 
software.amazon.awssdk.services.dynamodb.model.PutItemRequest;
 import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
 import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
 import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
+import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest;
 
 import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster;
 
@@ -132,7 +133,7 @@ public class ScanIndex3IT {
         }
 
         for (int i = 0; i < NUM_RECORDS; i++) {
-            if (i % 4 == 0 || i % 11 == 0) {
+            if (i % 4 == 0) {
                 Map<String, AttributeValue> key = new HashMap<>();
                 key.put("pk", AttributeValue.builder().s("pk_" + (i % 
100)).build());
                 key.put("sk", 
AttributeValue.builder().n(String.valueOf(i)).build());
@@ -140,6 +141,31 @@ public class ScanIndex3IT {
                         
DeleteItemRequest.builder().tableName(TABLE_NAME).key(key).build();
                 phoenixDBClientV2.deleteItem(deleteRequest);
                 dynamoDbClient.deleteItem(deleteRequest);
+            } else if (i % 11 == 0) {
+                Map<String, AttributeValue> key = new HashMap<>();
+                key.put("pk", AttributeValue.builder().s("pk_" + (i % 
100)).build());
+                key.put("sk", 
AttributeValue.builder().n(String.valueOf(i)).build());
+                final String updateExpression;
+                if (i % 33 == 0) {
+                    updateExpression = "REMOVE #st, #ts";
+                } else if (i % 22 == 0) {
+                    updateExpression = "REMOVE #ts";
+                } else {
+                    updateExpression = "REMOVE #st";
+                }
+                Map<String, String> exprAttrNames = new HashMap<>();
+                if (updateExpression.contains("#st")) {
+                    exprAttrNames.put("#st", "status");
+                }
+                if (updateExpression.contains("#ts")) {
+                    exprAttrNames.put("#ts", "timestamp");
+                }
+                UpdateItemRequest updateRequest =
+                        
UpdateItemRequest.builder().tableName(TABLE_NAME).key(key)
+                                .updateExpression(updateExpression)
+                                
.expressionAttributeNames(exprAttrNames).build();
+                phoenixDBClientV2.updateItem(updateRequest);
+                dynamoDbClient.updateItem(updateRequest);
             }
         }
     }

Reply via email to