test(reader): shared TestArrays builders; dedup array tests#56
Merged
Conversation
TestArrays centralises the Materialized*Array construction copy-pasted across ~17 reader tests; dtypes come from the shared DTypes constants. ArrayLimitedTest now uses it and adds Chunked* limited() coverage (limitedChildren + all 7 typed overrides). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Builders allocate from Arena.ofAuto() internally (test data is short-lived), so callers no longer thread a confined Arena through try-with-resources. ArrayLimitedTest sheds ~20 try blocks.
allocate(0, n) is legal and tested (empty bytes/bools cases), so the Math.max(1, ...) floors were dead code that made bytes()/bools() diverge from the other builders. Remove for consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Introduce
TestArrays— a single home for the in-memoryMaterialized*Arraybuilders that were copy-pasted across ~17 reader test files — and migrate the
straightforward duplicators onto it.
TestArrays:longs/ints/doubles/floats/shorts/bytes/bools/float16builders.Dtypes come from the shared
DTypesconstants; segments allocate fromArena.ofAuto()internally, so callers need no confined-Arenatry-with-resources ceremony.
ArrayLimitedTest,Long/Int/DoubleArrayTest,LazySparseArrayTest,ChunkedRecordSmokeTest,LazyDateTimePartsLongArrayTest,decode/LazyRunEndArrayTest.ArrayLimitedTestalso gainsChunked*.limited()coverage (thelimitedChildren+ 7 typed overrides that were at 0%).Why
Tests should be as simple as possible. The per-file builders duplicated the same
segment-allocation boilerplate; threading a confined
Arenathroughtry-with-resources added noise with no benefit for short-lived test data.
Left as-is (intentionally)
Specialized builders with no clean
TestArraysfit:DictRecordSmokeTest(unsigned-code dtype overloads),
VarBinChunkedModeTest(VarBin),LazyAlpRdArrayTest(U16 codes — I16 would changegetIntwidening),LazyDecimalBytePartsArrayTest(decimal).Verification
Test-only change. Full reader suite green (540 tests).
🤖 Generated with Claude Code