fn min_max_string<T: OffsetSizeTrait, F: Fn(&str, &str) -> bool>(
    array: &GenericStringArray<T>,
    cmp: F,
) -> Option<&str> {
    let null_count = array.null_count();

    if null_count == array.len() {
        return None;
    }
    let mut n = "";
    let mut has_value = false;
    let data = array.data();

    if null_count == 0 {
        for i in 0..data.len() {
            let item = array.value(i);
            if !has_value || cmp(&n, item) {
                has_value = true;
                n = item;
            }
        }
    } else {
        for i in 0..data.len() {
            let item = array.value(i);
            if data.is_valid(i) && (!has_value || cmp(&n, item)) {
                has_value = true;
                n = item;
            }
        }
    }
    Some(n)
}
/// Helper macro to perform min/max of strings
Helper macro to perform min/max of strings
Helper macro to perform min / max of strings
fn min_max_string<T: OffsetSizeTrait, F: Fn(&str, &str) -> bool>(
    array: &GenericStringArray<T>,
    cmp: F,
) -> Option<&str> {
    let null_count = array.null_count();
    if null_count == array.len() {
        return None;
    }
    let mut n = "";
    let mut has_value = false;
    let data = array.data();
    if null_count == 0 {
        for i in 0..data.len() {
            let item = array.value(i);
            if !has_value || cmp(&n, item) {
                has_value = true;
                n = item;
            }
        }
    } else {
        for i in 0..data.len() {
            let item = array.value(i);
            if data.is_valid(i) && (!has_value || cmp(&n, item)) {
                has_value = true;
                n = item;
            }
        }
    }
    Some(n)
}
fn min_max_string < T : OffsetSizeTrait , F : Fn ( & str , & str ) -> bool > ( array : & GenericStringArray < T > , cmp : F , ) -> Option < & str > { let null_count = array . null_count ( ) ; if null_count == array . len ( ) { return None ; } let mut n = " " ; let mut has_value = false ; let data = array . data ( ) ; if null_count == 0 { for i in 0 .. data . len ( ) { let item = array . value ( i ) ; if ! has_value || cmp ( & n , item ) { has_value = true ; n = item ; } } } else { for i in 0 .. data . len ( ) { let item = array . value ( i ) ; if data . is_valid ( i ) && ( ! has_value || cmp ( & n , item ) ) { has_value = true ; n = item ; } } } Some ( n ) }
Helper macro to perform min/max of strings
Helper macro to perform min / max of strings
array
&GenericStringArray<T>
cmp
F