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

Add a hint about normalization in error message (#14089) #14113

Conversation

cj-zhukov
Copy link
Contributor

Which issue does this PR close?

Closes #14089.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) common Related to common crate labels Jan 13, 2025
@@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

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

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

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 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

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @cj-zhukov and @comphead -- this is going to make DataFusion much easier to use

datafusion/expr/src/expr_rewriter/mod.rs Show resolved Hide resolved
@@ -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",
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 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

@github-actions github-actions bot removed the core Core DataFusion crate label Jan 14, 2025
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @cj-zhukov

@comphead comphead merged commit 0a2f09f into apache:main Jan 14, 2025
25 checks passed
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @cj-zhukov and @comphead -- this is a great improvement in my opinion

@cj-zhukov cj-zhukov deleted the cj-zhukov/Add-a-hint-about-normalization-in-error-message branch January 15, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate logical-expr Logical plan and expressions sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a hint about normalization in error message
3 participants