Arrow: Document NullabilityHolder.reset() null-marker contract - #17252
Arrow: Document NullabilityHolder.reset() null-marker contract#17252thswlsqls wants to merge 2 commits into
Conversation
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
| * <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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@ldudas-marx Thanks for the review. Moved the reasoning into the method body. I kept one line in the Javadoc — that reset() clears only the null count and leaves the per-index markers — since that's observable by any caller that reaches isNullAt(int) after a reset, which is what made this look like a bug in #15809. Happy to move all of it into the body if a committer prefers.
Keep the caller-facing part in the Javadoc: reset() clears only the null count and leaves the per-index markers. That is observable by anyone that reaches isNullAt(int) after a reset, which is what made this look like a bug. Move the reasoning about writers overwriting every marker before it is read into the method body, where it is closer to the code it explains. Generated-by: Claude Code
uros-b
left a comment
There was a problem hiding this comment.
Thank you @thswlsqls for keeping the javadocs up to date, LGTM!
Documents the behavior reported in #15808
Summary
NullabilityHolder.reset()clears onlynumNulls; theisNullmarker array read byisNullAt(int)is left as-is.VectorizedParquetDefinitionLevelReadersets the marker of each index viasetNull/setNotNull(or the bulksetNulls/setNotNulls) before any marker is read, so values from a previous batch are overwritten rather than observed.reset()stating this contract, so the behavior is not mistaken for a stale-state bug.reset().Testing done
./gradlew :iceberg-arrow:spotlessCheck— passed../gradlew :iceberg-arrow:checkstyleMain— passed.AI Disclosure
NullabilityHolder.reset()null-marker contract.