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

fix: FieldNotFound error message without valid fields #4942

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

DDtKey
Copy link
Contributor

@DDtKey DDtKey commented Jan 17, 2023

Which issue does this PR close?

Closes #4941

Rationale for this change

Avoid misleading error message with empty list of valid fields

Are these changes tested?

I've added one test to DFSchema, but you can point me to where I should add it

Are there any user-facing changes?

@@ -160,11 +158,11 @@ impl Display for SchemaError {
} else {
write!(f, "'{}'", field.name)?;
}
if let Some(fields) = valid_fields {
if !valid_fields.is_empty() {
Copy link
Contributor Author

@DDtKey DDtKey Jan 17, 2023

Choose a reason for hiding this comment

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

I'm wondering if we should add some additional text in case if it's empty?
Like No data source passed, No valid fields and etc.

If we should add it, pls add your suggestion of error message 🤔

I just kept the previous logic, but changed condition from Some to is not empty, because it looks like it supposed to work in this way

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to have a special case for this, otherwise it looks like the user would get the message valid fields are , which would be confusing.

Copy link
Contributor Author

@DDtKey DDtKey Jan 17, 2023

Choose a reason for hiding this comment

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

Currently (in this PR) it will just return Schema error: No field named 'name' (i.e valid fields are won't be in the message as before)

Let me know if I should add additional text for this case.

@@ -125,7 +125,7 @@ pub enum SchemaError {
/// No field with this name
FieldNotFound {
field: Column,
valid_fields: Option<Vec<Column>>,
valid_fields: Vec<Column>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've not found any reason to have Option here, Vec could be empty and it would be zero-size. Moreover, there is no usages of None at all.

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

Nice cleanup. Thanks @DDtKey

@DDtKey DDtKey force-pushed the fix-error-without-valid-fields branch from 046a471 to 6a96065 Compare January 17, 2023 16:55
@DDtKey
Copy link
Contributor Author

DDtKey commented Jan 17, 2023

@andygrove thanks!

Sorry, just updated formatting warnings (fmt by dev/rust_lint.sh), probably need to re-approve CI checks. Should be fine now

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

LGTM

@DDtKey DDtKey force-pushed the fix-error-without-valid-fields branch from 6a96065 to 769fbab Compare January 18, 2023 00:08
@github-actions github-actions bot added the sql SQL Planner label Jan 18, 2023
@DDtKey DDtKey force-pushed the fix-error-without-valid-fields branch from 769fbab to d68d31c Compare January 18, 2023 00:09
@github-actions github-actions bot added the optimizer Optimizer rules label Jan 18, 2023
@DDtKey
Copy link
Contributor Author

DDtKey commented Jan 18, 2023

@andygrove Forgot to push one of the files with changes, need on more time to re-approve checks, sorry for some mess.

This time it's gonna be successful, I double-checked locally and all changes were pushed now (tests & lints are passed)

@alamb alamb merged commit 8a34fe1 into apache:master Jan 18, 2023
@alamb
Copy link
Contributor

alamb commented Jan 18, 2023

Thanks @DDtKey !

@ursabot
Copy link

ursabot commented Jan 18, 2023

Benchmark runs are scheduled for baseline = ef4ca7e and contender = 8a34fe1. 8a34fe1 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@DDtKey DDtKey deleted the fix-error-without-valid-fields branch January 20, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect error message when there is no valid fields
4 participants