/// Validates the schema of the passed in columns, then adds their values to
/// the associated columns in the table and updates summary statistics.
Validates the schema of the passed in columns, then adds their values to
the associated columns in the table and updates summary statistics.
Validates the schema of the passed in columns then adds their values to the associated columns in the table and updates summary statistics .
pub fn write_columns(
        &mut self,
        _sequencer_id: u32,
        _sequence_number: u64,
        columns: Vec<entry::Column<'_>>,
    ) -> Result<()> {
        let row_count_before_insert = self.row_count();
        let additional_rows = columns.first().map(|x| x.row_count).unwrap_or_default();
        let final_row_count = row_count_before_insert + additional_rows;
        // get the column ids and validate schema for those that already exist
        columns.iter().try_for_each(|column| {
            ensure!(
                column.row_count == additional_rows,
                IncorrectRowCount {
                    column: column.name(),
                    expected: additional_rows,
                    actual: column.row_count,
                }
            );
            if let Some(c) = self.columns.get(column.name()) {
                c.validate_schema(&column).context(ColumnError {
                    column: column.name(),
                })?;
            }
            Ok(())
        })?;
        for fb_column in columns {
            let influx_type = fb_column.influx_type();
            let column = self
                .columns
                .raw_entry_mut()
                .from_key(fb_column.name())
                .or_insert_with(|| {
                    (
                        fb_column.name().to_string(),
                        Column::new(row_count_before_insert, influx_type),
                    )
                })
                .1;
            column.append(&fb_column).context(ColumnError {
                column: fb_column.name(),
            })?;
            assert_eq!(column.len(), final_row_count);
        }
        for c in self.columns.values_mut() {
            c.push_nulls_to_len(final_row_count);
        }
        Ok(())
    }
pub fn write_columns ( & mut self , _sequencer_id : u32 , _sequence_number : u64 , columns : Vec < entry :: Column < ' _ > > , ) -> Result < ( ) > { let row_count_before_insert = self . row_count ( ) ; let additional_rows = columns . first ( ) . map ( | x | x . row_count ) . unwrap_or_default ( ) ; let final_row_count = row_count_before_insert + additional_rows ; // get the column ids and validate schema for those that already exist columns . iter ( ) . try_for_each ( | column | { ensure ! ( column row_count additional_rows IncorrectRowCount { column column name ( ) expected additional_rows actual column row_count } ) ; if let Some ( c ) = self . columns . get ( column . name ( ) ) { c . validate_schema ( & column ) . context ( ColumnError { column : column . name ( ) , } ) ? ; } Ok ( ( ) ) } ) ? ; for fb_column in columns { let influx_type = fb_column . influx_type ( ) ; let column = self . columns . raw_entry_mut ( ) . from_key ( fb_column . name ( ) ) . or_insert_with ( | | { ( fb_column . name ( ) . to_string ( ) , Column :: new ( row_count_before_insert , influx_type ) , ) } ) . 1 ; column . append ( & fb_column ) . context ( ColumnError { column : fb_column . name ( ) , } ) ? ; assert_eq ! ( column len ( ) final_row_count ) ; } for c in self . columns . values_mut ( ) { c . push_nulls_to_len ( final_row_count ) ; } Ok ( ( ) ) }
Validates the schema of the passed in columns, then adds their values to
the associated columns in the table and updates summary statistics.
Validates the schema of the passed in columns then adds their values to the associated columns in the table and updates summary statistics .
&mut self
_sequencer_id
u32
_sequence_number
u64
columns
Vec<entry::Column<'_>>