Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data] Clarify schema validation error #48882

Merged
merged 7 commits into from
Nov 27, 2024
Merged

Conversation

bveeramani
Copy link
Member

@bveeramani bveeramani commented Nov 22, 2024

Why are these changes needed?

ray.data.range(1).groupby("does_not_exist").count().materialize()

Before

ValueError: The column 'does_not_exist' does not exist in the schema 'Column  Type
------  ----
id      int64'.

After

ValueError: You specified the column 'does_not_exist', but there's no such column in the dataset. The dataset has columns: {'id'}

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani bveeramani changed the title [Data] Improve schema validation [Data] Clarify schema validation error Nov 22, 2024
Comment on lines -84 to -85
"The column '{}' does not exist in the "
"schema '{}'.".format(column, schema)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to print full schema (though fixing the formatting)

Copy link
Member Author

Choose a reason for hiding this comment

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

@alexeykudinkin how would I fix the formatting?

I think it still looks a bit weird even if we move the schema to a newline:

ValueError: You specified the column 'does_not_exist', but there's no such column in the dataset. The dataset has schema:
Column  Type
------  ----
id      int64

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough, it will look fine when printed but when embedded it's gonna look messy.

Let's keep just the list of cols

@bveeramani bveeramani enabled auto-merge (squash) November 25, 2024 18:55
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Nov 25, 2024
Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Balaji Veeramani <[email protected]>
@github-actions github-actions bot disabled auto-merge November 25, 2024 22:49
Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani bveeramani enabled auto-merge (squash) November 26, 2024 02:22
@github-actions github-actions bot disabled auto-merge November 27, 2024 00:04
@bveeramani bveeramani merged commit 3bd3a02 into master Nov 27, 2024
5 checks passed
@bveeramani bveeramani deleted the improve-error-message branch November 27, 2024 17:45
jecsand838 pushed a commit to jecsand838/ray that referenced this pull request Dec 4, 2024
```python
ray.data.range(1).groupby("does_not_exist").count().materialize()
```

**Before**
```
ValueError: The column 'does_not_exist' does not exist in the schema 'Column  Type
------  ----
id      int64'.
```

**After**
```
ValueError: You specified the column 'does_not_exist', but there's no such column in the dataset. The dataset has columns: {'id'}
```

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Connor Sanders <[email protected]>
dentiny pushed a commit to dentiny/ray that referenced this pull request Dec 7, 2024
```python
ray.data.range(1).groupby("does_not_exist").count().materialize()
```

**Before**
```
ValueError: The column 'does_not_exist' does not exist in the schema 'Column  Type
------  ----
id      int64'.
```

**After**
```
ValueError: You specified the column 'does_not_exist', but there's no such column in the dataset. The dataset has columns: {'id'}
```

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: hjiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants