MCPcopy Create free account
hub / github.com/apache/datafusion / test_array

Function test_array

datafusion/functions/src/datetime/to_date.rs:275–303  ·  view source on GitHub ↗
(tc: &TestCase)

Source from the content-addressed store, hash-verified

273 }
274
275 fn test_array<A>(tc: &TestCase)
276 where
277 A: From<Vec<&'static str>> + Array + 'static,
278 {
279 let date_array = A::from(vec![tc.date_str]);
280 let batch_len = date_array.len();
281 let to_date_result = invoke_to_date_with_args(
282 vec![ColumnarValue::Array(Arc::new(date_array))],
283 batch_len,
284 );
285
286 match to_date_result {
287 Ok(ColumnarValue::Array(a)) => {
288 assert_eq!(a.len(), 1);
289
290 let expected = Date32Type::parse_formatted(tc.date_str, "%Y-%m-%d");
291 let mut builder = Date32Array::builder(4);
292 builder.append_value(expected.unwrap());
293
294 assert_eq!(
295 &builder.finish() as &dyn Array,
296 a.as_ref(),
297 "{}: to_date created wrong value",
298 tc.name
299 );
300 }
301 _ => panic!("Could not convert '{}' to Date", tc.date_str),
302 }
303 }
304 }
305
306 #[test]

Callers

nothing calls this directly

Calls 3

invoke_to_date_with_argsFunction · 0.85
lenMethod · 0.45
append_valueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…