feat(io): allow a custom parquet writer for points elements - #1201
Closed
cornhundred wants to merge 2 commits into
Closed
feat(io): allow a custom parquet writer for points elements#1201cornhundred wants to merge 2 commits into
cornhundred wants to merge 2 commits into
Conversation
Adds an optional points_writer hook to SpatialData.write() and write_points(), letting a caller control the points.parquet layout (row-group boundaries, compression, number of files) while SpatialData still writes all element metadata. Default behaviour is unchanged when the hook is omitted. This follows the existing pass-through option pattern on write() (shapes_geometry_encoding, raster_compressor, convert_table_strings_to_categoricals) rather than introducing a new concept, and it is deliberately layout-generic: nothing about it is specific to any tiling scheme or viewer. Motivation: producing spatially tiled row groups otherwise requires writing the points parquet once with the default writer and then rewriting it. On an 8M transcript Xenium dataset that measured 13.5s vs 8.5s, and it writes ~250MB of transient output that is immediately discarded -- a gap that widens on 300M-transcript panels. Note the hook receives the dataframe after transformations are stripped from attrs (as the default writer requires), so a writer needing the coordinate transform must obtain it from the element beforehand. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1201 +/- ##
=======================================
Coverage 91.89% 91.89%
=======================================
Files 53 53
Lines 7942 7947 +5
=======================================
+ Hits 7298 7303 +5
Misses 644 644
🚀 New features to boost your workflow:
|
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.
Adds an optional points_writer hook to SpatialData.write() and write_points(), letting a caller control the points.parquet layout (row-group boundaries, compression, number of files) while SpatialData still writes all element metadata. Default behaviour is unchanged when the hook is omitted.
This follows the existing pass-through option pattern on write() (shapes_geometry_encoding, raster_compressor,
convert_table_strings_to_categoricals) rather than introducing a new concept, and it is deliberately layout-generic: nothing about it is specific to any tiling scheme or viewer.
Motivation: producing spatially tiled row groups otherwise requires writing the points parquet once with the default writer and then rewriting it. On an 8M transcript Xenium dataset that measured 13.5s vs 8.5s, and it writes ~250MB of transient output that is immediately discarded -- a gap that widens on 300M-transcript panels.
Note the hook receives the dataframe after transformations are stripped from attrs (as the default writer requires), so a writer needing the coordinate transform must obtain it from the element beforehand.