Skip to content

Arrow: Document NullabilityHolder.reset() null-marker contract#17252

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:docs/arrow-nullabilityholder-reset-contract
Open

Arrow: Document NullabilityHolder.reset() null-marker contract#17252
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:docs/arrow-nullabilityholder-reset-contract

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Documents the behavior reported in #15808

Summary

  • NullabilityHolder.reset() clears only numNulls; the isNull marker array read by isNullAt(int) is left as-is.
  • This is intentional, not a bug: for every batch, VectorizedParquetDefinitionLevelReader sets the marker of each index via setNull/setNotNull (or the bulk setNulls/setNotNulls) before any marker is read, so values from a previous batch are overwritten rather than observed.
  • Add Javadoc on reset() stating this contract, so the behavior is not mistaken for a stale-state bug.
  • On closed PR Arrow: Fix NullabilityHolder.reset() to clear the isNull array #16264, the reviewer noted writers set all values explicitly and suggested documenting this instead of changing reset().

Testing done

  • Javadoc-only change, no behavior change — no test added.
  • ./gradlew :iceberg-arrow:spotlessCheck — passed.
  • ./gradlew :iceberg-arrow:checkstyleMain — passed.

reset() clears only the null count and intentionally leaves the isNull
marker array as-is. Writers repopulate every index of each batch before
the markers are read, so stale values are overwritten rather than
observed. Document this so the behavior is not mistaken for a bug.

Generated-by: Claude Code
@github-actions github-actions Bot added the arrow label Jul 16, 2026
Comment on lines +81 to +85
* <p>Only the null count is cleared. The per-index markers returned by {@link #isNullAt(int)} are
* deliberately left untouched: for every batch, writers set the marker of each index through
* {@link #setNull(int)}/{@link #setNotNull(int)} (or their bulk variants {@link #setNulls(int,
* int)}/{@link #setNotNulls(int, int)}) before the markers are read, so values carried over from
* a previous batch are overwritten rather than observed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would put these into the function body as comments because it contains implementation details and insights. It targets developers who want to change this class and not the users who want to use this class.

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.

2 participants