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

Function into_array_of_size

datafusion/expr-common/src/columnar_value.rs:417–442  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415
416 #[test]
417 fn into_array_of_size() {
418 // Array case
419 let arr = make_array(1, 3);
420 let arr_columnar_value = ColumnarValue::Array(Arc::clone(&arr));
421 assert_eq!(&arr_columnar_value.into_array_of_size(3).unwrap(), &arr);
422
423 // Scalar case
424 let scalar_columnar_value = ColumnarValue::Scalar(ScalarValue::Int32(Some(42)));
425 let expected_array = make_array(42, 100);
426 assert_eq!(
427 &scalar_columnar_value.into_array_of_size(100).unwrap(),
428 &expected_array
429 );
430
431 // Array case with wrong size
432 let arr = make_array(1, 3);
433 let arr_columnar_value = ColumnarValue::Array(Arc::clone(&arr));
434 let result = arr_columnar_value.into_array_of_size(5);
435 let err = result.unwrap_err();
436 assert!(
437 err.to_string().starts_with(
438 "Internal error: Array length 3 does not match expected length 5"
439 ),
440 "Found: {err}"
441 );
442 }
443
444 #[test]
445 fn values_to_arrays() {

Callers

nothing calls this directly

Calls 3

make_arrayFunction · 0.85
into_array_of_sizeMethod · 0.80
unwrap_errMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…