Skip to content

Conversation

@rmorgans
Copy link
Contributor

Summary

  • Extracts common logic for LIST, MAP, and FIXED_SIZE_LIST into a shared visitListLike helper function
  • Ensures nullableInParent is always set correctly before visiting child values, making it impossible to forget this step when adding new list-like type handling
  • Uses defLevelOffset parameter to calculate defLevelIfEmpty after all increments

Rationale

This refactoring follows the principle of "making invalid states unrepresentable". The original bug in #584 (fixed in #585) was caused by the FIXED_SIZE_LIST case forgetting to set nullableInParent. By extracting the common pattern into a helper function, future additions of list-like types cannot omit this critical step.

Test plan

🤖 Generated with Claude Code

@rmorgans rmorgans requested a review from zeroshade as a code owner November 30, 2025 00:07
Extract common logic for LIST, MAP, and FIXED_SIZE_LIST into a shared
visitListLike helper function. This ensures nullableInParent is always
set correctly before visiting child values, making it impossible to
forget this step when adding new list-like type handling.

The defLevelOffset parameter allows each type to specify how defLevelIfEmpty
should be calculated relative to maxDefLevel after all increments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@rmorgans rmorgans force-pushed the refactor-visitlistlike branch from 8e4c876 to 6a09d78 Compare November 30, 2025 00:39
@zeroshade zeroshade merged commit 154b3f5 into apache:main Dec 1, 2025
16 checks passed
@rmorgans rmorgans deleted the refactor-visitlistlike branch December 9, 2025 10:48
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