Skip to content

Improve error messages to include the function name. - #14511

Merged
comphead merged 4 commits into
apache:mainfrom
Omega359:functions_improve_errors
Feb 6, 2025
Merged

Improve error messages to include the function name.#14511
comphead merged 4 commits into
apache:mainfrom
Omega359:functions_improve_errors

Conversation

@Omega359

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

Function signature error messages do not include the function name making for debugging issues very difficult in a system with dataframes with hundreds of function calls.

What changes are included in this PR?

Updated error messages and tests.

Are these changes tested?

Yes

Are there any user-facing changes?

Unless you count updated error messages, no.

@github-actionsgithub-actionsBot added sql SQL Planner logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt) labels Feb 5, 2025
@Omega359
Omega359 marked this pull request as ready for review February 5, 2025 13:54

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you 💯 so much @Omega359 -- this is much better.

I made some suggestions to improve the wording of the errors but we can do that as a follow on PR (or never). This PR is already much better than it was

Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/sqllogictest/test_files/expr.slt Outdated
Comment threaddatafusion/sqllogictest/test_files/math.slt Outdated
Comment threaddatafusion/sqllogictest/test_files/math.slt Outdated
Comment threaddatafusion/sqllogictest/test_files/math.slt Outdated
Comment threaddatafusion/sqllogictest/test_files/scalar.slt Outdated
Words better this PR has.
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
Comment threaddatafusion/expr/src/type_coercion/functions.rs Outdated
@github-actionsgithub-actionsBot added the optimizer Optimizer rules label Feb 5, 2025

@compheadcomphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would prefer the function name to be highlighted some how, it can uppercase or square brackets, otherwise the function name got lost in the message

@Omega359

Omega359 commented Feb 5, 2025

Copy link
Copy Markdown
ContributorAuthor

I would prefer the function name to be highlighted some how, it can uppercase or square brackets, otherwise the function name got lost in the message

  1. Function test expects NativeType::Numeric but received NativeType::String
  2. Function [test] expects NativeType::Numeric but received NativeType::String
  3. Function TEST expects NativeType::Numeric but received NativeType::String
  4. Function 'TEST' expects NativeType::Numeric but received NativeType::String
  5. Function 'test' expects NativeType::Numeric but received NativeType::String

my preference is the last version.

@comphead

Copy link
Copy Markdown
Contributor

I would prefer the function name to be highlighted some how, it can uppercase or square brackets, otherwise the function name got lost in the message

  1. Function test expects NativeType::Numeric but received NativeType::String
  2. Function [test] expects NativeType::Numeric but received NativeType::String
  3. Function TEST expects NativeType::Numeric but received NativeType::String
  4. Function 'TEST' expects NativeType::Numeric but received NativeType::String
  5. Function 'test' expects NativeType::Numeric but received NativeType::String

my preference is the last version.

Yeah, love it. Function name is not allowed to include special characters so it should be good

@Omega359

Copy link
Copy Markdown
ContributorAuthor

Any other opinions on the function name highlight version? I'll wait to do the work till eod today in case there is a good reason not to go with # 5

@compheadcomphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm thanks @Omega359

@davispdavisp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a +1 for going with option #5 on adding single quotes around the function name. Otherwise I'm +1.

@Omega359

Copy link
Copy Markdown
ContributorAuthor

Updates applied.

@comphead
comphead merged commit ad60ffc into apache:mainFeb 6, 2025
@comphead

Copy link
Copy Markdown
Contributor

Thanks everyone!

@alamb

alamb commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

Along with this PR from @Lordworms DataFusion error messages are getting downright friendly!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-exprLogical plan and expressionsoptimizerOptimizer rulessqlSQL PlannersqllogictestSQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Omega359@comphead@alamb@davisp@mbrobbel