Repository navigation
Conversation
Broadcasts over StructArrays with nested-array columns sent results whose element type is not inferred concretely to the nested-array path, which collects them into a plain Array, struct results included. Before the nested broadcast style existed (ArraysOfArrays 0.6), StructArrays' own path returned a StructArray for these. Now only results inferred as a concrete non-struct type take the nested-array path, all others Base's copy, which takes the element type from the values and allocates via similar, also when it widens. A similar method for these broadcasts allocates a StructArray only for result types that StructArrays can rebuild from their fields: concrete struct types, and tuple and named tuple types with definite fields. So arrays, which StructArrays treats as structs (Array since Julia 1.11), and widened types with parameters that the fields do not determine stay in plain Arrays. Non-inferred results of zero-dimensional broadcasts are still returned unwrapped, as Base does. Block-wise evaluation over disk-backed data joins blocks of different element types into a container allocated via similar as well, so struct results stay StructArrays there too. Fixes #77. Assisted-By: generative AI
Assisted-By: generative AI
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #78 +/- ##
==========================================
- Coverage 98.08% 97.95% -0.14%
==========================================
Files 17 17
Lines 1308 1318 +10
==========================================
+ Hits 1283 1291 +8
- Misses 25 27 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Assisted-By: generative AI
This branch has not been deployed
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.
Opened by Claude (Opus 5.5, effort level: max), working with @oschulz.
Broadcasts over a
StructArraywith nested-array columns returned a plainArrayfor struct-valued results whose type is not inferred concretely, so code that reads fields of the result, like LegendDSP'sbl_stats.mean, failed. Such results now take StructArrays' own path again, as in 0.6 before the nested broadcast style existed: Base'scopytakes the element type from the values, and a newsimilarmethod for these broadcasts decides between aStructArrayand a plainArray, also when Base widens the element type.Fixes #77.
Background
minimum.(inters.x; init=0u"s")over µs values infers asQuantity{T,𝐓} where T, so theifelseand the wholesignalstatsbroadcast infer asAny. Reproduced with RadiationDetectorSignals 0.3.12 and RadiationDetectorDSP 0.2.21:bl_statsis aVectorwith 1.4.2 and aStructVectorwith this PR, with identical values.Design notes
Arrayincluded since Julia 1.11, so array results would become StructArrays withrefandsizecolumns, and named tuples with varying names or tuples of varying length throw inside StructArrays. The newsimilarmethod therefore gives aStructArrayonly for result types that StructArrays can rebuild exactly from their fields: concrete struct types, and tuple and named tuple types with definite fields. Widened types with parameters that the fields don't determine stay in plain Arrays, as in 1.4.2.Testing
Full suite on Julia 1.13, except the Reactant test, whose CUDA library does not load on the local aarch64 machine, and the affected files on Julia 1.10. The new tests fail on 1.4.2, with the routing change alone, with all non-concrete struct types accepted, and without unwrapping zero-dimensional results. Codex (gpt-6-astra) reproduced the LegendDSP case and reviewed the change; its two findings, lost type parameters when widening and wrapped zero-dimensional results, are fixed and tested.
Version bumped to 1.4.3.