Skip to content

Core: Fix ShreddedObject.put not clearing prior remove marker#17066

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/shreddedobject-put-clear-remove-marker
Open

Core: Fix ShreddedObject.put not clearing prior remove marker#17066
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/shreddedobject-put-clear-remove-marker

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #17063

Summary

  • ShreddedObject.put(field, value) left a prior remove(field) marker in removedFields, so remove() followed by put() of the same field made get()/fieldNames()/numFields() report the field missing while writeTo() still serialized it with the new value.
  • Fix clears removedFields.remove(field) in put(), mirroring how remove() already clears shreddedFields for the field.
  • Query API and serialized bytes now agree after a remove-then-put sequence.

Testing done

  • Added TestShreddedObject#testPutAfterRemoveClearsRemoveMarker covering remove() then put() of the same field, asserting get()/numFields()/fieldNames() reflect the new value and the writeTo() round trip serializes it.
  • ./gradlew :iceberg-core:test --tests "org.apache.iceberg.variants.TestShreddedObject" — 23 tests passed.
  • ./gradlew :iceberg-core:check — spotlessCheck, checkstyleMain/Test/Jmh passed; full test suite timed out in CI session (large module), covered by the targeted test above instead.
  • ./gradlew :iceberg-core:revapi — passed (backward compatible, no signature change).

put(field, value) added the field back to shreddedFields but left any
prior removedFields marker for that field in place. get(), fieldNames(),
and numFields() short-circuit on removedFields, so a remove() followed
by a put() of the same field made query APIs report the field as
missing while writeTo() still serialized it with its new value.

Clear the removedFields marker in put(), mirroring how remove() already
clears the shreddedFields entry, so query results and serialized bytes
agree. Adds a regression test in TestShreddedObject covering the
remove-then-put sequence via get()/numFields()/fieldNames() and a
writeTo() round trip.

Generated-by: Claude Code
@github-actions github-actions Bot added the core label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core: Fix ShreddedObject.put not clearing prior remove marker

2 participants