-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
@@ -160,11 +158,11 @@ impl Display for SchemaError { | |||
} else { | |||
write!(f, "'{}'", field.name)?; | |||
} | |||
if let Some(fields) = valid_fields { | |||
if !valid_fields.is_empty() { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
046a471
to
6a96065
Compare
@andygrove thanks! Sorry, just updated formatting warnings ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6a96065
to
769fbab
Compare
769fbab
to
d68d31c
Compare
@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) |
Thanks @DDtKey ! |
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. |
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 itAre there any user-facing changes?