This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 710b6b4bcf [Bug] Fix debezium-json cannot infer primary keys from
standard Debezium message key (#9495)
710b6b4bcf is described below
commit 710b6b4bcf6dbb6af7860f9914a8b1dca11968f8
Author: Arvin <[email protected]>
AuthorDate: Wed Sep 2 16:19:15 2026 +0800
[Bug] Fix debezium-json cannot infer primary keys from standard Debezium
message key (#9495)
---
.../debezium/DebeziumJsonRecordParserTest.java | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git
a/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/format/debezium/DebeziumJsonRecordParserTest.java
b/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/format/debezium/DebeziumJsonRecordParserTest.java
index 747c56d5b5..4cb64c11f6 100644
---
a/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/format/debezium/DebeziumJsonRecordParserTest.java
+++
b/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/format/debezium/DebeziumJsonRecordParserTest.java
@@ -69,6 +69,32 @@ public class DebeziumJsonRecordParserTest {
assertPrimaryKeys(key, value("[]"), "id");
}
+ @Test
+ public void testPrimaryKeysFromValueWithSchemaEnvelope() throws Exception {
+ // Simulates the exact scenario from issue #8961:
+ // Value has schema+payload envelope (standard Debezium JSON),
+ // and primary keys come from the Kafka message key.
+ JsonNode key =
+ OBJECT_MAPPER.readTree(
+ "{\"schema\":{\"type\":\"struct\",\"fields\":["
+ +
"{\"type\":\"int64\",\"optional\":false,\"field\":\"id\"}]},"
+ + "\"payload\":{\"id\":1}}");
+
+ JsonNode value =
+ OBJECT_MAPPER.readTree(
+ "{\"schema\":{\"type\":\"struct\",\"fields\":["
+ + "{\"type\":\"struct\",\"fields\":["
+ +
"{\"type\":\"int64\",\"optional\":false,\"field\":\"id\"},"
+ +
"{\"type\":\"string\",\"optional\":true,\"field\":\"name\"}],"
+ + "\"optional\":true,\"field\":\"after\"}],"
+ +
"\"optional\":false},\"payload\":{\"before\":null,"
+ + "\"after\":{\"id\":1,\"name\":\"Alice\"},"
+ +
"\"source\":{\"db\":\"test\",\"table\":\"users\"},"
+ + "\"op\":\"c\"}}");
+
+ assertPrimaryKeys(key, value, "id");
+ }
+
private static JsonNode value(String primaryKeys) throws Exception {
String primaryKeyField = primaryKeys == null ? "" : "\"pkNames\":" +
primaryKeys + ",";
return OBJECT_MAPPER.readTree(