feat: parameterize S2_CoveringCellIds (min_level, max_level, max_cells)#1023
Open
ajaypadwal73 wants to merge 2 commits into
Open
feat: parameterize S2_CoveringCellIds (min_level, max_level, max_cells)#1023ajaypadwal73 wants to merge 2 commits into
ajaypadwal73 wants to merge 2 commits into
Conversation
Open
1 task
CI can't fetch commit 45a0ecf from paleolimbot/s2geography since it only exists on a fork branch. Temporarily point at the fork (paleolimbot/s2geography#123) until it merges upstream.
Contributor
Author
|
Hey @paleolimbot, can you please take a look at this? |
paleolimbot
reviewed
Jul 8, 2026
Comment on lines
+38
to
+44
| Optional positional arguments can control the covering: | ||
|
|
||
| | Argument | Description | Default | | ||
| | --- | --- | --- | | ||
| | `min_level` | Minimum S2 cell level to return. Must be between 0 and 30. | 0 | | ||
| | `max_level` | Maximum S2 cell level to return. Must be between 0 and 30. | 30 | | ||
| | `max_cells` | Maximum number of cells to return. Must be greater than 0. | 8 | |
Member
There was a problem hiding this comment.
Instead of as a table, can you give these labels and descriptions in the yaml itself? You can see the documentation for st_buffer which does this.
Comment on lines
+97
to
+105
| @pytest.mark.parametrize("eng", [SedonaDB]) | ||
| def test_s2_coveringcellids_parameters(eng): | ||
| eng = eng.create_or_skip() | ||
| result = eng.execute_and_collect( | ||
| "SELECT S2_CoveringCellIds(" | ||
| "ST_GeogFromText('LINESTRING (0 0, 100 50)'), 0, 30, 2)" | ||
| ) | ||
| df = eng.result_to_pandas(result) | ||
| assert len(df.iloc[0, 0]) <= 2 |
Member
There was a problem hiding this comment.
Can you add tests for all of the overloads that are exposed here? (min level and min + max level overloads are missing here). They can all be in the same Python test.
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.
Summary
min_level,max_level,max_cellspositional args toS2_CoveringCellIds, matching BigQuery's S2 covering signature.S2_CoveringCellIdsreturns NULL (rather than failing to resolve) when any parameter is a literal NULL.min_level=0,max_level=30,max_cells=8, unchanged from prior hardcoded behavior).Closes #920
Submodule status
The
s2geographyC++ change backing this lives in paleolimbot/s2geography#123. Until that merges,.gitmodulestemporarily points the submodule at my fork (ajaypadwal73/s2geography) so CI can resolve the pinned commit. Once #123 merges upstream, this PR needs a follow-up commit reverting.gitmodulestopaleolimbot/s2geographyand re-pinning the submodule to the merged commit.Test plan
covering_cell_ids_return_type) covers return-type resolution for all arg-count/NULL-position combinations.test_s2_coveringcellids_parameters).coverings_test.cc) cover the new kernels, level-fixing, point-parent, and max_cells behavior..gitmodulesto upstreams2geographyonce Parameterize S2 covering cell IDs (min_level, max_level, max_cells) paleolimbot/s2geography#123 merges.