fn write_columns(&mut self, columns: Vec<entry::Column<'_>>) -> Result<()> {
        let row_count_before_insert = self.rows();
        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.
Validates the schema of the passed in columns then adds their values to the associated columns in the table and updates summary statistics .
fn write_columns(&mut self, columns: Vec<entry::Column<'_>>) -> Result<()> {
        let row_count_before_insert = self.rows();
        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(())
    }
fn write_columns ( & mut self , columns : Vec < entry :: Column < ' _ > > ) -> Result < ( ) > { let row_count_before_insert = self . rows ( ) ; 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
columns
Vec<entry::Column<'_>>
&mut self
columns
Vec<entry::Column<'_>>