From fa40d57bd89d7aea93f7ea98be6918e5c82184ed Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Sun, 5 May 2024 10:05:57 +0100 Subject: [PATCH] Single quotes not backticks in errors to match DataFusion (#9) --- src/common.rs | 6 +++--- src/json_contains.rs | 2 +- tests/main.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common.rs b/src/common.rs index 15fb3f1..0df41a2 100644 --- a/src/common.rs +++ b/src/common.rs @@ -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 ), }) diff --git a/src/json_contains.rs b/src/json_contains.rs index 31a0f8b..821c04a 100644 --- a/src/json_contains.rs +++ b/src/json_contains.rs @@ -46,7 +46,7 @@ impl ScalarUDFImpl for JsonContains { fn return_type(&self, arg_types: &[DataType]) -> Result { 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) } diff --git a/tests/main.rs b/tests/main.rs index 7974ec9..3531b77 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -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." ); }