jorgecarleitao / arrow2

Transmute-free Rust library to work with the Arrow format
Apache License 2.0
1.07k stars 220 forks source link

Expose utf8_substring and binary_substring #1538

Closed orlp closed 11 months ago

orlp commented 11 months ago

Right now arrow2 only exposes

pub fn substring(array: &dyn Array, start: i64, length: &Option<u64>) -> Result<Box<dyn Array>> {

which forces you to go through a boxed generic. If you know you have a specific type you should be able to directly call

fn utf8_substring<O: Offset>(array: &Utf8Array<O>, start: O, length: &Option<O>) -> Utf8Array<O> {

or

fn binary_substring<O: Offset>(array: &BinaryArray<O>, start: O, length: &Option<O>) -> BinaryArray<O> {

which already exist, but are not marked as public.