virajjasani commented on code in PR #2209:
URL: https://github.com/apache/phoenix/pull/2209#discussion_r2190482509
##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CDCGlobalIndexRegionScanner.java:
##########
@@ -259,4 +310,44 @@ private Object getColumnValue(byte[] cellValue, int
offset, int length, PDataTyp
}
return CDCUtil.getColumnEncodedValue(value, dataType);
}
+
+ /**
+ * Handles CDC events that already contain pre-image data, avoiding data
table scan.
+ * Supports both the new CDC_IMAGE_CQ column and traditional CDC JSON
column.
+ *
+ * @param indexRow The CDC index row cells
+ * @param indexRowKey The CDC index row key
+ * @param indexCell The primary index cell
+ * @param result The result list to populate
+ * @return true if event was processed successfully
+ */
+ private boolean handlePreImageCDCEvent(List<Cell> indexRow, byte[]
indexRowKey,
+ Cell indexCell, List<Cell> result) {
+ Cell cdcDataCell = null;
+ for (Cell cell : indexRow) {
+ if (Bytes.equals(cell.getQualifierArray(),
cell.getQualifierOffset(),
+ cell.getQualifierLength(),
+ QueryConstants.CDC_IMAGE_CQ_BYTES, 0,
+ QueryConstants.CDC_IMAGE_CQ_BYTES.length)) {
+ cdcDataCell = cell;
+ break;
+ }
+ }
+ if (cdcDataCell == null) {
+ return false;
+ }
+ byte[] cdcEventBytes = CellUtil.cloneValue(cdcDataCell);
Review Comment:
Yes exactly, the optimization will not be applicable here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]