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

Single quotes not backticks in errors to match DataFusion #9

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use jiter::{Jiter, JiterError, Peek};

pub fn check_args(args: &[DataType], fn_name: &str) -> DataFusionResult<()> {
let Some(first) = args.first() else {
return plan_err!("The `{fn_name}` function requires one or more arguments.");
return plan_err!("The '{fn_name}' function requires one or more arguments.");
};
if !matches!(first, DataType::Utf8 | DataType::LargeUtf8) {
return plan_err!("Unexpected argument type to `{fn_name}` at position 1, expected a string.");
return plan_err!("Unexpected argument type to '{fn_name}' at position 1, expected a string.");
}
args[1..].iter().enumerate().try_for_each(|(index, arg)| match arg {
DataType::Utf8 | DataType::LargeUtf8 | DataType::UInt64 | DataType::Int64 => Ok(()),
_ => plan_err!(
"Unexpected argument type to `{fn_name}` at position {}, expected string or int.",
"Unexpected argument type to '{fn_name}' at position {}, expected string or int.",
index + 2
),
})
Expand Down
2 changes: 1 addition & 1 deletion src/json_contains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl ScalarUDFImpl for JsonContains {

fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
if arg_types.len() < 2 {
plan_err!("The `json_contains` function requires two or more arguments.")
plan_err!("The 'json_contains' function requires two or more arguments.")
} else {
check_args(arg_types, self.name()).map(|()| DataType::Boolean)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async fn test_json_get_str_null() {

assert_eq!(
e.to_string(),
"Error during planning: Unexpected argument type to `json_get_str` at position 2, expected string or int."
"Error during planning: Unexpected argument type to 'json_get_str' at position 2, expected string or int."
);
}

Expand Down
Loading