Skip to content

NIFI-16067 - PutIcebergRecord maps fields by ordinal position instead of column name#11387

Open
maltesander wants to merge 2 commits into
apache:mainfrom
maltesander:NIFI-16067
Open

NIFI-16067 - PutIcebergRecord maps fields by ordinal position instead of column name#11387
maltesander wants to merge 2 commits into
apache:mainfrom
maltesander:NIFI-16067

Conversation

@maltesander

Copy link
Copy Markdown

Summary

NIFI-16067 - PutIcebergRecord maps fields by ordinal position instead of column name

PutIcebergRecord (added in NIFI-15062) doesn't match columns by name. It writes each record's values into the Iceberg table columns by position, and the position it uses is the one from the incoming record schema, not the table schema. So the mapping is wrong whenever the input field order doesn't line up with the table's column order.

If the record has fewer fields than the table, the missing columns aren't set to NULL either - the values just shift left into whatever table column happens to sit at that position. Sometimes that lands on an incompatible type and you get a ClassCastException, which is the good outcome because at least it fails loudly. When the types happen to line up, the row is written with values in the wrong columns and nothing complains.

This gets worse with schema evolution: as soon as you add a column, the producer and the table no longer agree on the column set, and existing flows start silently writing data into the wrong place.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging and addressing this issue @maltesander. The general approach looks good, I will take a closer look at the changes and follow up soon.

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.

2 participants