Skip to content

[Data] Replace the KeyError when a partition field is missing - #66695

Merged
iamjustinhsu merged 2 commits into
ray-project:masterfrom
jackylee-ch:data/partitioning-missing-field-error
Oct 29, 2026
Merged

iamjustinhsu merged 2 commits into
ray-project:masterfrom
jackylee-ch:data/partitioning-missing-field-error

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Description

A partition field declared in field_types but absent from a parsed path raised a bare KeyError:

PathPartitionParser(Partitioning("hive", field_types={"year": int, "month": int}))("year=2020/data.parquet")
# was: KeyError: 'month'
# now: ValueError: Expected partition field 'month' (declared in `field_types`) in path 'year=2020/data.parquet', but found ['year'].

Related issues

None.

Additional information

No open PR touches partitioning.py. The new regression test fails on the prior code (bare KeyError) and passes with the fix; pre-commit is clean; the full test_partitioning.py suite and bazel run in CI. AI assistance (Claude) was used; I reviewed every changed line.

A field declared in `field_types` but absent from a parsed path raised a
bare KeyError. Name the missing field and the path instead.

Signed-off-by: jackylee-ch <[email protected]>
@jackylee-ch
jackylee-ch requested a review from a team as a code owner October 3, 2026 13:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves error handling in the path partition parser by raising a descriptive ValueError when a declared partition field is missing from the parsed path, replacing a previous bare KeyError. A corresponding unit test has been added to verify this behavior. No review comments were provided.

@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Oct 3, 2026

@iamjustinhsu iamjustinhsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@iamjustinhsu iamjustinhsu added the go add ONLY when ready to merge, run all tests label Oct 7, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 22, 2026
@richardliaw

Copy link
Copy Markdown
Contributor

CI failing

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Oct 29, 2026
Sync through upstream commit cd7636d, including the torch-scatter
lock refresh in PR ray-project#66713. The original partitioning patch is unchanged
relative to upstream.

Signed-off-by: jackylee-ch <[email protected]>
@jackylee-ch

Copy link
Copy Markdown
Contributor Author

Synced the branch through #66713 to update the stale torch-scatter hashes that failed all seven image-build steps. The original PR patch is unchanged. The old lock reproduced the hash error locally; all seven updated dependency-download cases pass hash verification. CI is rerunning.

@iamjustinhsu
iamjustinhsu merged commit 4d12b23 into ray-project:master Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants