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

Report current operation when coercion fails #13628

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

findepi
Copy link
Member

@findepi findepi commented Dec 3, 2024

This makes for a more actionable error message.

@@ -218,7 +240,8 @@ fn try_coerce_types(

// none possible -> Error
plan_err!(
"Coercion from {:?} to the signature {:?} failed.",
"{}: coercion from {:?} to the signature {:?} failed.",
Copy link
Member

@Weijun-H Weijun-H Dec 3, 2024

Choose a reason for hiding this comment

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

How about this?

Suggested change
"{}: coercion from {:?} to the signature {:?} failed.",
"Function {} failed to coerce from {:?} to the signature {:?}.",

This makes for a more actionable error message.
@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Dec 3, 2024
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 @findepi and @Weijun-H -- these are much nicer error messages 💯

@@ -1357,7 +1357,7 @@ mod test {

let err = Projection::try_new(vec![udaf], empty).err().unwrap();
assert!(
err.strip_backtrace().starts_with("Error during planning: Error during planning: Coercion from [Utf8] to the signature Uniform(1, [Float64]) failed")
err.strip_backtrace().starts_with("Error during planning: Error during planning: MY_AVG: coercion from [Utf8] to the signature Uniform(1, [Float64]) failed")
Copy link
Contributor

Choose a reason for hiding this comment

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

this is much nicer 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants