Returns the raw bytes at the given index from a binary-like array, return `None` if the array isn't binary-like.
(array: &dyn Array, index: usize)
| 43 | |
| 44 | /// Returns the raw bytes at the given index from a binary-like array, return `None` if the array isn't binary-like. |
| 45 | pub(crate) fn binary_array_value(array: &dyn Array, index: usize) -> Option<&[u8]> { |
| 46 | match array.data_type() { |
| 47 | DataType::Binary => Some(array.as_binary::<i32>().value(index)), |
| 48 | DataType::LargeBinary => Some(array.as_binary::<i64>().value(index)), |
| 49 | DataType::BinaryView => Some(array.as_binary_view().value(index)), |
| 50 | _ => None, |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Returns a [`Variant`] from a `metadata` and `value` byte arrays, returns `None` |
| 55 | /// if one of them is of invalid type. |