You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "cj-zhukov (via GitHub)" <gi...@apache.org> on 2025/01/13 14:50:01 UTC
[PR] Add a hint about normalization in error message (#14089) [datafusion]
cj-zhukov opened a new pull request, #14113:
URL: https://github.com/apache/datafusion/pull/14113
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #14089.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Add a hint about normalization in error message (#14089) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #14113:
URL: https://github.com/apache/datafusion/pull/14113#discussion_r1913554182
##########
datafusion/expr/src/expr_rewriter/mod.rs:
##########
@@ -462,10 +462,11 @@ mod test {
normalize_col_with_schemas_and_ambiguity_check(expr, &[&schemas], &[])
.unwrap_err()
.strip_backtrace();
- assert_eq!(
- error,
- r#"Schema error: No field named b. Valid fields are "tableA".a."#
- );
+ let expected = "Schema error: No field named b. \
+ You can use double quotes to refer to the \"b\" column \
+ or set the datafusion.sql_parser.enable_ident_normalization configuration option. \
+ Valid fields are \"tableA\".a.";
Review Comment:
I think this is confusing as the message says use \"b\" but there is no column named `b`
Can you change it so that the normalization suggestion is only shown when a column name in the schema would have matched if the case was different?
##########
datafusion/common/src/error.rs:
##########
@@ -167,6 +167,12 @@ impl Display for SchemaError {
valid_fields,
} => {
write!(f, "No field named {}", field.quoted_flat_name())?;
+ write!(
+ f,
+ ". You can use double quotes to refer to the \"{}\" column",
Review Comment:
I think it is important to provide an alternate syntax for users of end systems who can not control the DataFusion settings. For example, for our InfluxDB users they can't set the configuration settings
I suspect the @TheBuilderJR 's users would likely not be able to change this setting
What about something like this (only in cases where the schema contains a column that matches except for case)
```
Column names are case sensitive. Use double quotes to refer to the "z" column
or set the datafusion.sql_parser.enable_ident_normalization configuration
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Add a hint about normalization in error message (#14089) [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #14113:
URL: https://github.com/apache/datafusion/pull/14113#discussion_r1913491424
##########
datafusion/common/src/error.rs:
##########
@@ -167,6 +167,12 @@ impl Display for SchemaError {
valid_fields,
} => {
write!(f, "No field named {}", field.quoted_flat_name())?;
+ write!(
+ f,
+ ". You can use double quotes to refer to the \"{}\" column",
Review Comment:
its not only double quotes, its been 3 symbols at least.
Prob we can refer to case sensitivity instead, sort of
```
DataFusion column names are case sensitive. For case insensitive mode set datafusion.sql_parser.enable_ident_normalization option
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Add a hint about normalization in error message (#14089) [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead merged PR #14113:
URL: https://github.com/apache/datafusion/pull/14113
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Add a hint about normalization in error message (#14089) [datafusion]
Posted by "cj-zhukov (via GitHub)" <gi...@apache.org>.
cj-zhukov commented on code in PR #14113:
URL: https://github.com/apache/datafusion/pull/14113#discussion_r1914318162
##########
datafusion/expr/src/expr_rewriter/mod.rs:
##########
@@ -462,10 +462,11 @@ mod test {
normalize_col_with_schemas_and_ambiguity_check(expr, &[&schemas], &[])
.unwrap_err()
.strip_backtrace();
- assert_eq!(
- error,
- r#"Schema error: No field named b. Valid fields are "tableA".a."#
- );
+ let expected = "Schema error: No field named b. \
+ You can use double quotes to refer to the \"b\" column \
+ or set the datafusion.sql_parser.enable_ident_normalization configuration option. \
+ Valid fields are \"tableA\".a.";
Review Comment:
Andrew, it's a great point! I'll change it to make more clear.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org