Skip to content

feat(python): support integer column indices in read_url projection - #10287

Open
jackylee-ch wants to merge 2 commits into
vortex-data:developfrom
jackylee-ch:feat/read-url-int-projection
Open

jackylee-ch wants to merge 2 commits into
vortex-data:developfrom
jackylee-ch:feat/read-url-int-projection

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

What

read_url's docstring and .pyi stub both document projection as
list[str | int] ("identified either by their index or name"), but
projection_from_python only accepted strings and raised TypeError on an
integer — so read_url(url, projection=[0, 2]) crashed despite being the
documented, type-checked form.

Fix

Map an integer to the top-level field name at the matching position (threading
the file dtype into projection_from_python), erroring on an out-of-range index
or a non-struct file. String projection is unchanged. Scoped to read_url /
VortexDataset, which is where int projection is documented.

AI assistance

Prepared with AI assistance; I have reviewed and verified the change.

`read_url`'s docstring and type stub both document `projection` as
`list[str | int]` ("by their index or name"), but the implementation only
accepted strings and raised `TypeError` on an integer, so the documented
positional form never worked.

Map an integer to the top-level field name at the matching position (threading
the file dtype into `projection_from_python`), erroring on an out-of-range index
or a non-struct file. String projection is unchanged.

Signed-off-by: jackylee-ch <[email protected]>
Comment thread vortex-python/src/dataset.rs Outdated
Replace the manual isinstance branching in projection_from_python with a
FromPyObject-derived `ProjectionColumn` enum, as suggested in review.

Signed-off-by: jackylee-ch <[email protected]>
@robert3005 robert3005 added the changelog/feature A new feature label Oct 4, 2026
@robert3005
robert3005 enabled auto-merge (squash) October 4, 2026 20:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants