fix(rust/sedona-functions): Ensure WkbView types can be aggregated using the groups accumulator for ST_Envelope_Agg#656
Open
paleolimbot wants to merge 3 commits intoapache:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in ST_Envelope_Agg where grouped aggregation would fail when the input geometry was stored as a view type (WkbView). The root cause was that the merge_batch method incorrectly assumed the state type was identical to the input type, when in fact the state is always represented as WKB_GEOMETRY regardless of the input type.
Changes:
- Added sentinel constants for view geometry types with item CRS to support testing and type handling
- Modified the
execute_updatemethod to accept an explicitinput_typeparameter, distinguishing between input and state types - Updated
merge_batchto always useWKB_GEOMETRYfor state deserialization, consistent with other aggregate functions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/sedona-schema/src/datatypes.rs | Added WKB_VIEW_GEOMETRY_ITEM_CRS and WKB_VIEW_GEOGRAPHY_ITEM_CRS sentinel constants for view types with item CRS metadata |
| rust/sedona-functions/src/st_envelope_agg.rs | Fixed merge_batch to use WKB_GEOMETRY for state and parameterized execute_update to handle input type separately; added comprehensive tests for view types |
| python/sedonadb/tests/functions/test_aggregate.py | Added integration test with real-world parquet data to verify grouped aggregation works with view types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes the aggregation from a view type: we had been assuming that the state was identical to the input; however, this is not the case if the input is a view type for the grouped accumulator.
Closes #653.