pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
    if arrays.is_empty() {
        return Err(ArrowError::ComputeError(
            "concat requires input of at least one array".to_string(),
        ));
    }

    if arrays
        .iter()
        .any(|array| array.data_type() != arrays[0].data_type())
    {
        return Err(ArrowError::InvalidArgumentError(
            "It is not possible to concatenate arrays of different data types."
                .to_string(),
        ));
    }

    let lengths = arrays.iter().map(|array| array.len()).collect::<Vec<_>>();
    let capacity = lengths.iter().sum();

    let arrays = arrays
        .iter()
        .map(|a| a.data_ref().as_ref())
        .collect::<Vec<_>>();

    let mut mutable = MutableArrayData::new(arrays, false, capacity);

    for (i, len) in lengths.iter().enumerate() {
        mutable.extend(i, 0, *len)
    }

    Ok(make_array(Arc::new(mutable.freeze())))
}
/// Concatenate multiple [Array] of the same type into a single [ArrayRef].
Concatenate multiple [Array] of the same type into a single [ArrayRef].
Concatenate multiple [ Array ] of the same type into a single [ ArrayRef ] .
pub fn concat(arrays: &[&Array]) -> Result<ArrayRef> {
    if arrays.is_empty() {
        return Err(ArrowError::ComputeError(
            "concat requires input of at least one array".to_string(),
        ));
    }
    if arrays
        .iter()
        .any(|array| array.data_type() != arrays[0].data_type())
    {
        return Err(ArrowError::InvalidArgumentError(
            "It is not possible to concatenate arrays of different data types."
                .to_string(),
        ));
    }
    let lengths = arrays.iter().map(|array| array.len()).collect::<Vec<_>>();
    let capacity = lengths.iter().sum();
    let arrays = arrays
        .iter()
        .map(|a| a.data_ref().as_ref())
        .collect::<Vec<_>>();
    let mut mutable = MutableArrayData::new(arrays, false, capacity);
    for (i, len) in lengths.iter().enumerate() {
        mutable.extend(i, 0, *len)
    }
    Ok(make_array(Arc::new(mutable.freeze())))
}
pub fn concat ( arrays : & [ & Array ] ) -> Result < ArrayRef > { if arrays . is_empty ( ) { return Err ( ArrowError :: ComputeError ( " " . to_string ( ) , ) ) ; } if arrays . iter ( ) . any ( | array | array . data_type ( ) != arrays [ 0 ] . data_type ( ) ) { return Err ( ArrowError :: InvalidArgumentError ( " " . to_string ( ) , ) ) ; } let lengths = arrays . iter ( ) . map ( | array | array . len ( ) ) . collect :: < Vec < _ > > ( ) ; let capacity = lengths . iter ( ) . sum ( ) ; let arrays = arrays . iter ( ) . map ( | a | a . data_ref ( ) . as_ref ( ) ) . collect :: < Vec < _ > > ( ) ; let mut mutable = MutableArrayData :: new ( arrays , false , capacity ) ; for ( i , len ) in lengths . iter ( ) . enumerate ( ) { mutable . extend ( i , 0 , * len ) } Ok ( make_array ( Arc :: new ( mutable . freeze ( ) ) ) ) }
Concatenate multiple [Array] of the same type into a single [ArrayRef].
Concatenate multiple [ Array ] of the same type into a single [ ArrayRef ] .
arrays
&[&Array]
arrays
&[&Array]