fn create_table(results: &[RecordBatch]) -> Result<Table> {
    let mut table = Table::new();
    table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);

    if results.is_empty() {
        return Ok(table);
    }

    let schema = results[0].schema();

    let mut header = Vec::new();
    for field in schema.fields() {
        header.push(Cell::new(&field.name()));
    }
    table.set_titles(Row::new(header));

    for batch in results {
        for row in 0..batch.num_rows() {
            let mut cells = Vec::new();
            for col in 0..batch.num_columns() {
                let column = batch.column(col);
                cells.push(Cell::new(&array_value_to_string(column.clone(), row)?));
            }
            table.add_row(Row::new(cells));
        }
    }

    Ok(table)
}
///! Convert a series of record batches into a table
Convert a series of record batches into a table
Convert a series of record batches into a table
fn create_table(results: &[RecordBatch]) -> Result<Table> {
    let mut table = Table::new();
    table.set_format(*format::consts::FORMAT_NO_LINESEP_WITH_TITLE);
    if results.is_empty() {
        return Ok(table);
    }
    let schema = results[0].schema();
    let mut header = Vec::new();
    for field in schema.fields() {
        header.push(Cell::new(&field.name()));
    }
    table.set_titles(Row::new(header));
    for batch in results {
        for row in 0..batch.num_rows() {
            let mut cells = Vec::new();
            for col in 0..batch.num_columns() {
                let column = batch.column(col);
                cells.push(Cell::new(&array_value_to_string(column.clone(), row)?));
            }
            table.add_row(Row::new(cells));
        }
    }
    Ok(table)
}
fn create_table ( results : & [ RecordBatch ] ) -> Result < Table > { let mut table = Table :: new ( ) ; table . set_format ( * format :: consts :: FORMAT_NO_LINESEP_WITH_TITLE ) ; if results . is_empty ( ) { return Ok ( table ) ; } let schema = results [ 0 ] . schema ( ) ; let mut header = Vec :: new ( ) ; for field in schema . fields ( ) { header . push ( Cell :: new ( & field . name ( ) ) ) ; } table . set_titles ( Row :: new ( header ) ) ; for batch in results { for row in 0 .. batch . num_rows ( ) { let mut cells = Vec :: new ( ) ; for col in 0 .. batch . num_columns ( ) { let column = batch . column ( col ) ; cells . push ( Cell :: new ( & array_value_to_string ( column . clone ( ) , row ) ? ) ) ; } table . add_row ( Row :: new ( cells ) ) ; } } Ok ( table ) }
Convert a series of record batches into a table
Convert a series of record batches into a table
results
&[RecordBatch]
results
&[RecordBatch]