MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_string_concat_slice

Function test_string_concat_slice

arrow-string/src/concat_elements.rs:436–478  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

434
435 #[test]
436 fn test_string_concat_slice() {
437 let left = &StringArray::from(vec![None, Some("foo"), Some("bar"), Some("baz")]);
438 let right = &StringArray::from(vec![Some("boo"), None, Some("far"), Some("faz")]);
439
440 let left_slice = left.slice(0, 3);
441 let right_slice = right.slice(1, 3);
442 let output = concat_elements_utf8(
443 left_slice
444 .as_any()
445 .downcast_ref::<GenericStringArray<i32>>()
446 .unwrap(),
447 right_slice
448 .as_any()
449 .downcast_ref::<GenericStringArray<i32>>()
450 .unwrap(),
451 )
452 .unwrap();
453
454 let expected = [None, Some("foofar"), Some("barfaz")]
455 .into_iter()
456 .collect::<StringArray>();
457
458 assert_eq!(output, expected);
459
460 let left_slice = left.slice(2, 2);
461 let right_slice = right.slice(1, 2);
462
463 let output = concat_elements_utf8(
464 left_slice
465 .as_any()
466 .downcast_ref::<GenericStringArray<i32>>()
467 .unwrap(),
468 right_slice
469 .as_any()
470 .downcast_ref::<GenericStringArray<i32>>()
471 .unwrap(),
472 )
473 .unwrap();
474
475 let expected = [None, Some("bazfar")].into_iter().collect::<StringArray>();
476
477 assert_eq!(output, expected);
478 }
479
480 #[test]
481 fn test_string_concat_error_empty() {

Callers

nothing calls this directly

Calls 4

concat_elements_utf8Function · 0.85
sliceMethod · 0.45
as_anyMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected