File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ pub fn check_args(args: &[DataType], fn_name: &str) -> DataFusionResult<()> {
11
11
return plan_err ! ( "The '{fn_name}' function requires one or more arguments." ) ;
12
12
} ;
13
13
if !matches ! ( first, DataType :: Utf8 | DataType :: LargeUtf8 ) {
14
- return plan_err ! ( "Unexpected argument type to '{fn_name}' at position 1, expected a string." ) ;
14
+ return plan_err ! ( "Unexpected argument type to '{fn_name}' at position 1, expected a string, got {first:?} ." ) ;
15
15
}
16
16
args[ 1 ..] . iter ( ) . enumerate ( ) . try_for_each ( |( index, arg) | match arg {
17
17
DataType :: Utf8 | DataType :: LargeUtf8 | DataType :: UInt64 | DataType :: Int64 => Ok ( ( ) ) ,
18
- _ => plan_err ! (
19
- "Unexpected argument type to '{fn_name}' at position {}, expected string or int." ,
18
+ t => plan_err ! (
19
+ "Unexpected argument type to '{fn_name}' at position {}, expected string or int, got {t:?} ." ,
20
20
index + 2
21
21
) ,
22
22
} )
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ async fn test_json_get_str_null() {
185
185
186
186
assert_eq ! (
187
187
e. to_string( ) ,
188
- "Error during planning: Unexpected argument type to 'json_get_str' at position 2, expected string or int."
188
+ "Error during planning: Unexpected argument type to 'json_get_str' at position 2, expected string or int, got Null ."
189
189
) ;
190
190
}
191
191
@@ -207,6 +207,12 @@ async fn test_json_get_int() {
207
207
assert_eq ! ( display_val( batches) . await , ( DataType :: Int64 , "2" . to_string( ) ) ) ;
208
208
}
209
209
210
+ #[ tokio:: test]
211
+ async fn test_json_get_path ( ) {
212
+ let batches = run_query ( r#"select json_get('{"i": 19}', 'i')::int<20"# ) . await . unwrap ( ) ;
213
+ assert_eq ! ( display_val( batches) . await , ( DataType :: Boolean , "true" . to_string( ) ) ) ;
214
+ }
215
+
210
216
#[ tokio:: test]
211
217
async fn test_json_get_cast_int ( ) {
212
218
let sql = r#"select json_get('{"foo": 42}', 'foo')::int"# ;
You can’t perform that action at this time.
0 commit comments