pub fn create_key(
    group_by_keys: &[ArrayRef],
    row: usize,
    vec: &mut Vec<GroupByScalar>,
) -> Result<(), Error> {
    for i in 0..group_by_keys.len() {
        let col = &group_by_keys[i];
        match col.data_type() {
            DataType::Boolean => {
                let array = col.as_any().downcast_ref::<BooleanArray>().unwrap();
                vec[i] = GroupByScalar::Boolean(array.value(row))
            }
            DataType::UInt8 => {
                let array = col.as_any().downcast_ref::<UInt8Array>().unwrap();
                vec[i] = GroupByScalar::UInt8(array.value(row))
            }
            DataType::UInt16 => {
                let array = col.as_any().downcast_ref::<UInt16Array>().unwrap();
                vec[i] = GroupByScalar::UInt16(array.value(row))
            }
            DataType::UInt32 => {
                let array = col.as_any().downcast_ref::<UInt32Array>().unwrap();
                vec[i] = GroupByScalar::UInt32(array.value(row))
            }
            DataType::UInt64 => {
                let array = col.as_any().downcast_ref::<UInt64Array>().unwrap();
                vec[i] = GroupByScalar::UInt64(array.value(row))
            }
            DataType::Int8 => {
                let array = col.as_any().downcast_ref::<Int8Array>().unwrap();
                vec[i] = GroupByScalar::Int8(array.value(row))
            }
            DataType::Int16 => {
                let array = col.as_any().downcast_ref::<Int16Array>().unwrap();
                vec[i] = GroupByScalar::Int16(array.value(row))
            }
            DataType::Int32 => {
                let array = col.as_any().downcast_ref::<Int32Array>().unwrap();
                vec[i] = GroupByScalar::Int32(array.value(row))
            }
            DataType::Int64 => {
                let array = col.as_any().downcast_ref::<Int64Array>().unwrap();
                vec[i] = GroupByScalar::Int64(array.value(row))
            }
            DataType::Utf8 => {
                let array = col.as_any().downcast_ref::<StringArray>().unwrap();
                vec[i] = GroupByScalar::Utf8(String::from(array.value(row)))
            }
            _ => {
                return Err(Error::Unexpected);
            }
        }
    }
    Ok(())
}
/// Create a Vec<GroupByScalar> that can be used as a map key
Create a Vec that can be used as a map key
Create a Vec that can be used as a map key
pub fn create_key(
    group_by_keys: &[ArrayRef],
    row: usize,
    vec: &mut Vec<GroupByScalar>,
) -> Result<(), Error> {
    for i in 0..group_by_keys.len() {
        let col = &group_by_keys[i];
        match col.data_type() {
            DataType::Boolean => {
                let array = col.as_any().downcast_ref::<BooleanArray>().unwrap();
                vec[i] = GroupByScalar::Boolean(array.value(row))
            }
            DataType::UInt8 => {
                let array = col.as_any().downcast_ref::<UInt8Array>().unwrap();
                vec[i] = GroupByScalar::UInt8(array.value(row))
            }
            DataType::UInt16 => {
                let array = col.as_any().downcast_ref::<UInt16Array>().unwrap();
                vec[i] = GroupByScalar::UInt16(array.value(row))
            }
            DataType::UInt32 => {
                let array = col.as_any().downcast_ref::<UInt32Array>().unwrap();
                vec[i] = GroupByScalar::UInt32(array.value(row))
            }
            DataType::UInt64 => {
                let array = col.as_any().downcast_ref::<UInt64Array>().unwrap();
                vec[i] = GroupByScalar::UInt64(array.value(row))
            }
            DataType::Int8 => {
                let array = col.as_any().downcast_ref::<Int8Array>().unwrap();
                vec[i] = GroupByScalar::Int8(array.value(row))
            }
            DataType::Int16 => {
                let array = col.as_any().downcast_ref::<Int16Array>().unwrap();
                vec[i] = GroupByScalar::Int16(array.value(row))
            }
            DataType::Int32 => {
                let array = col.as_any().downcast_ref::<Int32Array>().unwrap();
                vec[i] = GroupByScalar::Int32(array.value(row))
            }
            DataType::Int64 => {
                let array = col.as_any().downcast_ref::<Int64Array>().unwrap();
                vec[i] = GroupByScalar::Int64(array.value(row))
            }
            DataType::Utf8 => {
                let array = col.as_any().downcast_ref::<StringArray>().unwrap();
                vec[i] = GroupByScalar::Utf8(String::from(array.value(row)))
            }
            _ => {
                return Err(Error::Unexpected);
            }
        }
    }
    Ok(())
}
pub fn create_key ( group_by_keys : & [ ArrayRef ] , row : usize , vec : & mut Vec < GroupByScalar > , ) -> Result < ( ) , Error > { for i in 0 .. group_by_keys . len ( ) { let col = & group_by_keys [ i ] ; match col . data_type ( ) { DataType :: Boolean => { let array = col . as_any ( ) . downcast_ref :: < BooleanArray > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Boolean ( array . value ( row ) ) } DataType :: UInt8 => { let array = col . as_any ( ) . downcast_ref :: < UInt8Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: UInt8 ( array . value ( row ) ) } DataType :: UInt16 => { let array = col . as_any ( ) . downcast_ref :: < UInt16Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: UInt16 ( array . value ( row ) ) } DataType :: UInt32 => { let array = col . as_any ( ) . downcast_ref :: < UInt32Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: UInt32 ( array . value ( row ) ) } DataType :: UInt64 => { let array = col . as_any ( ) . downcast_ref :: < UInt64Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: UInt64 ( array . value ( row ) ) } DataType :: Int8 => { let array = col . as_any ( ) . downcast_ref :: < Int8Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Int8 ( array . value ( row ) ) } DataType :: Int16 => { let array = col . as_any ( ) . downcast_ref :: < Int16Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Int16 ( array . value ( row ) ) } DataType :: Int32 => { let array = col . as_any ( ) . downcast_ref :: < Int32Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Int32 ( array . value ( row ) ) } DataType :: Int64 => { let array = col . as_any ( ) . downcast_ref :: < Int64Array > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Int64 ( array . value ( row ) ) } DataType :: Utf8 => { let array = col . as_any ( ) . downcast_ref :: < StringArray > ( ) . unwrap ( ) ; vec [ i ] = GroupByScalar :: Utf8 ( String :: from ( array . value ( row ) ) ) } _ => { return Err ( Error :: Unexpected ) ; } } } Ok ( ( ) ) }
Create a Vec<GroupByScalar> that can be used as a map key
Create a Vec<GroupByScalar > that can be used as a map key
group_by_keys
&[ArrayRef]
row
usize
vec
&mut Vec<GroupByScalar>
group_by_keys
&[ArrayRef]
row
usize
vec
&mut Vec<GroupByScalar>