| 1745 | |
| 1746 | #[test] |
| 1747 | fn test_take_slice_string() { |
| 1748 | let strings = StringArray::from(vec![Some("hello"), None, Some("world"), None, Some("hi")]); |
| 1749 | let indices = Int32Array::from(vec![Some(0), Some(1), None, Some(0), Some(2)]); |
| 1750 | let indices_slice = indices.slice(1, 4); |
| 1751 | let expected = StringArray::from(vec![None, None, Some("hello"), Some("world")]); |
| 1752 | let result = take(&strings, &indices_slice, None).unwrap(); |
| 1753 | assert_eq!(result.as_ref(), &expected); |
| 1754 | } |
| 1755 | |
| 1756 | /// Take from a *sliced* byte array, i.e. one whose value offsets do not |
| 1757 | /// start at zero. This exercises copying byte data out of an array with a |