You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by vj...@apache.org on 2026/05/26 18:47:34 UTC

(phoenix-adapters) branch main updated: Set OLD/NEW image in stream record only when they are not empty

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

virajjasani 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 892858f  Set OLD/NEW image in stream record only when they are not empty
892858f is described below

commit 892858f487d4e07d3b243c4fcff3ac2e97167de9
Author: Palash Chauhan <pa...@gmail.com>
AuthorDate: Fri Feb 20 02:04:50 2026 -0800

    Set OLD/NEW image in stream record only when they are not empty
---
 .../apache/phoenix/ddb/service/GetRecordsService.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/GetRecordsService.java b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/GetRecordsService.java
index 10882ed..84ec289 100644
--- a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/GetRecordsService.java
+++ b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/GetRecordsService.java
@@ -171,14 +171,22 @@ public class GetRecordsService {
         PhoenixStreamRecord phoenixStreamRecord = new PhoenixStreamRecord(cdcJson, pkCols);
         switch (streamType) {
             case OLD_IMAGE:
-                streamRecord.put(ApiMetadata.OLD_IMAGE, phoenixStreamRecord.getPreImage());
+                if (phoenixStreamRecord.hasPreImage()) {
+                    streamRecord.put(ApiMetadata.OLD_IMAGE, phoenixStreamRecord.getPreImage());
+                }
                 break;
             case NEW_IMAGE:
-                streamRecord.put(ApiMetadata.NEW_IMAGE, phoenixStreamRecord.getPostImage());
+                if (phoenixStreamRecord.hasPostImage()) {
+                    streamRecord.put(ApiMetadata.NEW_IMAGE, phoenixStreamRecord.getPostImage());
+                }
                 break;
             case NEW_AND_OLD_IMAGES:
-                streamRecord.put(ApiMetadata.OLD_IMAGE, phoenixStreamRecord.getPreImage());
-                streamRecord.put(ApiMetadata.NEW_IMAGE, phoenixStreamRecord.getPostImage());
+                if (phoenixStreamRecord.hasPreImage()) {
+                    streamRecord.put(ApiMetadata.OLD_IMAGE, phoenixStreamRecord.getPreImage());
+                }
+                if (phoenixStreamRecord.hasPostImage()) {
+                    streamRecord.put(ApiMetadata.NEW_IMAGE, phoenixStreamRecord.getPostImage());
+                }
                 break;
         }
         //always set keys