pub fn optimize_dictionaries(batch: &RecordBatch) -> Result<RecordBatch> {
    let schema = batch.schema();
    let new_columns = batch
        .columns()
        .iter()
        .zip(schema.fields())
        .map(|(col, field)| match field.data_type() {
            DataType::Dictionary(key, value) => optimize_dict_col(col, key, value),
            _ => Ok(Arc::clone(col)),
        })
        .collect::<Result<Vec<_>>>()?;

    RecordBatch::try_new(schema, new_columns)
}
/// Takes a record batch and returns a new record batch with dictionaries
/// optimized to contain no duplicate or unreferenced values
///
/// Where the input dictionaries are sorted, the output dictionaries will also be
Takes a record batch and returns a new record batch with dictionaries
optimized to contain no duplicate or unreferenced values


Takes a record batch and returns a new record batch with dictionaries optimized to contain no duplicate or unreferenced values
pub fn optimize_dictionaries(batch: &RecordBatch) -> Result<RecordBatch> {
    let schema = batch.schema();
    let new_columns = batch
        .columns()
        .iter()
        .zip(schema.fields())
        .map(|(col, field)| match field.data_type() {
            DataType::Dictionary(key, value) => optimize_dict_col(col, key, value),
            _ => Ok(Arc::clone(col)),
        })
        .collect::<Result<Vec<_>>>()?;
    RecordBatch::try_new(schema, new_columns)
}
pub fn optimize_dictionaries ( batch : & RecordBatch ) -> Result < RecordBatch > { let schema = batch . schema ( ) ; let new_columns = batch . columns ( ) . iter ( ) . zip ( schema . fields ( ) ) . map ( | ( col , field ) | match field . data_type ( ) { DataType :: Dictionary ( key , value ) => optimize_dict_col ( col , key , value ) , _ => Ok ( Arc :: clone ( col ) ) , } ) . collect :: < Result < Vec < _ > > > ( ) ? ; RecordBatch :: try_new ( schema , new_columns ) }
Takes a record batch and returns a new record batch with dictionaries
optimized to contain no duplicate or unreferenced values
Takes a record batch and returns a new record batch with dictionaries optimized to contain no duplicate or unreferenced values
batch
&RecordBatch
batch
&RecordBatch