/// Create and validate a new Schema, creating metadata to
/// represent the the various parts. This method is intended to be
/// used only by the SchemaBuilder.
Create and validate a new Schema, creating metadata to
represent the the various parts. This method is intended to be
used only by the SchemaBuilder.
Create and validate a new Schema creating metadata to represent the the various parts . This method is intended to be used only by the SchemaBuilder .
pub(crate) fn new_from_parts(
        measurement: Option<String>,
        fields: impl Iterator<Item = (ArrowField, Option<InfluxColumnType>)>,
        sort_columns: bool,
    ) -> Result<Self> {
        let mut metadata = HashMap::new();
        if let Some(measurement) = measurement {
            metadata.insert(MEASUREMENT_METADATA_KEY.to_string(), measurement);
        }
        let mut fields: Vec<ArrowField> = fields
            .map(|(mut field, column_type)| {
                set_field_metadata(&mut field, column_type);
                field
            })
            .collect();
        if sort_columns {
            fields.sort_unstable_by(|a, b| a.name().cmp(b.name()));
        }
        // Call new_from_arrow to do normal, additional validation
        // (like dupe column detection)
        let record =
            ArrowSchemaRef::new(ArrowSchema::new_with_metadata(fields, metadata)).try_into()?;
        Ok(record)
    }
pub ( crate ) fn new_from_parts ( measurement : Option < String > , fields : impl Iterator < Item = ( ArrowField , Option < InfluxColumnType > ) > , sort_columns : bool , ) -> Result < Self > { let mut metadata = HashMap :: new ( ) ; if let Some ( measurement ) = measurement { metadata . insert ( MEASUREMENT_METADATA_KEY . to_string ( ) , measurement ) ; } let mut fields : Vec < ArrowField > = fields . map ( | ( mut field , column_type ) | { set_field_metadata ( & mut field , column_type ) ; field } ) . collect ( ) ; if sort_columns { fields . sort_unstable_by ( | a , b | a . name ( ) . cmp ( b . name ( ) ) ) ; } // Call new_from_arrow to do normal, additional validation // (like dupe column detection) let record = ArrowSchemaRef :: new ( ArrowSchema :: new_with_metadata ( fields , metadata ) ) . try_into ( ) ? ; Ok ( record ) }
Create and validate a new Schema, creating metadata to
represent the the various parts.
Create and validate a new Schema creating metadata to represent the the various parts .
measurement
Option<String>
fields
impl Iterator<Item = (ArrowField, Option<InfluxColumnType>)>
sort_columns
bool