@@ -277,6 +277,20 @@ async fn test_json_get_cast_float() {
277
277
assert_eq ! ( display_val( batches) . await , ( DataType :: Float64 , "420.0" . to_string( ) ) ) ;
278
278
}
279
279
280
+ #[ tokio:: test]
281
+ async fn test_json_get_cast_numeric ( ) {
282
+ let sql = r#"select json_get('{"foo": 4.2e2}', 'foo')::numeric"# ;
283
+ let batches = run_query ( sql) . await . unwrap ( ) ;
284
+ assert_eq ! ( display_val( batches) . await , ( DataType :: Float64 , "420.0" . to_string( ) ) ) ;
285
+ }
286
+
287
+ #[ tokio:: test]
288
+ async fn test_json_get_cast_numeric_equals ( ) {
289
+ let sql = r#"select json_get('{"foo": 420}', 'foo')::numeric = 420"# ;
290
+ let batches = run_query ( sql) . await . unwrap ( ) ;
291
+ assert_eq ! ( display_val( batches) . await , ( DataType :: Boolean , "true" . to_string( ) ) ) ;
292
+ }
293
+
280
294
#[ tokio:: test]
281
295
async fn test_json_get_bool ( ) {
282
296
let batches = run_query ( "select json_get_bool('[true]', 0)" ) . await . unwrap ( ) ;
@@ -1101,7 +1115,7 @@ async fn test_arrow_scalar_union_is_null() {
1101
1115
}
1102
1116
1103
1117
#[ tokio:: test]
1104
- async fn test_arrow_cast ( ) {
1118
+ async fn test_long_arrow_cast ( ) {
1105
1119
let batches = run_query ( "select (json_data->>'foo')::int from other" ) . await . unwrap ( ) ;
1106
1120
1107
1121
let expected = [
@@ -1116,3 +1130,9 @@ async fn test_arrow_cast() {
1116
1130
] ;
1117
1131
assert_batches_eq ! ( expected, & batches) ;
1118
1132
}
1133
+
1134
+ async fn test_arrow_cast_numeric ( ) {
1135
+ let sql = r#"select ('{"foo": 420}'->'foo')::numeric = 420"# ;
1136
+ let batches = run_query ( sql) . await . unwrap ( ) ;
1137
+ assert_eq ! ( display_val( batches) . await , ( DataType :: Boolean , "true" . to_string( ) ) ) ;
1138
+ }
0 commit comments