Skip to content

[cdc] Fix NPE when metadata columns are used with debezium-bson format - #9055

Merged
JingsongLi merged 1 commit into
apache:masterfrom
thswlsqls:fix/cdc-bson-parser-metadata-npe
Aug 7, 2026
Merged

[cdc] Fix NPE when metadata columns are used with debezium-bson format#9055
JingsongLi merged 1 commit into
apache:masterfrom
thswlsqls:fix/cdc-bson-parser-metadata-npe

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #9054

  • DebeziumBsonRecordParser#setRoot overrides AbstractRecordParser#setRoot without storing the record, so evalMetadataColumns passes a null currentRecord to the converters. Using --metadata_column with value.format=debezium-bson throws NPE on the first record.
  • Assign currentRecord directly instead of calling super.setRoot: DebeziumJsonRecordParser#setRoot also parses the Debezium value schema, which BSON events do not carry.
  • The sibling parsers already store the record; Add metadata column support for Kafka CDC connector #7315 added only the consumer to the BSON parser.
  • Without metadata columns the converter array is empty, so behavior is unchanged.

Tests

  • Added DebeziumBsonRecordParserTest#extractRecordWithMetadataColumns, asserting the topic and offset values and schema columns. It fails with NPE before the fix.
  • mvn -pl paimon-flink/paimon-flink-cdc -Pflink1 -Dtest='!*ITCase' clean install (JDK 11): 148 tests passed in each of the two surefire executions.
  • Kafka/MongoDB/MySQL *ITCase need Docker and were not run locally — covered by CI.

DebeziumBsonRecordParser#setRoot did not store the current record, so
AbstractRecordParser#evalMetadataColumns passed null to the metadata
converters and threw NPE on the first record whenever --metadata_column
was used. The sibling parsers already store it (apache#7315).

Generated-by: Claude Code
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit 1a3dcad into apache:master Aug 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] NPE when metadata columns are used with debezium-bson format

2 participants