pub fn with_schema_modify<F>(self, f: F) -> Result<Self>
    where
        F: Fn(Schema) -> Result<Schema>,
    {
        let mut file = std::fs::File::open(&self.path)?;
        let reader_bytes = get_reader_bytes(&mut file).expect("could not mmap file");
        let mut skip_rows = self.skip_rows;

        let (schema, _) = infer_file_schema(
            &reader_bytes,
            self.delimiter,
            self.infer_schema_length,
            self.has_header,
            // we set it to None and modify them after the schema is updated
            None,
            &mut skip_rows,
            self.comment_char,
            self.quote_char,
            None,
        )?;
        let mut schema = f(schema)?;

        // the dtypes set may be for the new names, so update again
        if let Some(overwrite_schema) = self.schema_overwrite {
            for (name, dtype) in overwrite_schema.iter() {
                schema.with_column(name.clone(), dtype.clone())
            }
        }

        Ok(self.with_schema(Arc::new(schema)))
    }
/// Modify a schema before we run the lazy scanning.
///
/// Important! Run this function latest in the builder!
Modify a schema before we run the lazy scanning.
Important. Run this function latest in the builder!
Modify a schema before we run the lazy scanning . Important . Run this function latest in the builder!
pub fn with_schema_modify<F>(self, f: F) -> Result<Self>
    where
        F: Fn(Schema) -> Result<Schema>,
    {
        let mut file = std::fs::File::open(&self.path)?;
        let reader_bytes = get_reader_bytes(&mut file).expect("could not mmap file");
        let mut skip_rows = self.skip_rows;
        let (schema, _) = infer_file_schema(
            &reader_bytes,
            self.delimiter,
            self.infer_schema_length,
            self.has_header,
            // we set it to None and modify them after the schema is updated
            None,
            &mut skip_rows,
            self.comment_char,
            self.quote_char,
            None,
        )?;
        let mut schema = f(schema)?;
        // the dtypes set may be for the new names, so update again
        if let Some(overwrite_schema) = self.schema_overwrite {
            for (name, dtype) in overwrite_schema.iter() {
                schema.with_column(name.clone(), dtype.clone())
            }
        }
        Ok(self.with_schema(Arc::new(schema)))
    }
pub fn with_schema_modify < F > ( self , f : F ) -> Result < Self > where F : Fn ( Schema ) -> Result < Schema > , { let mut file = std :: fs :: File :: open ( & self . path ) ? ; let reader_bytes = get_reader_bytes ( & mut file ) . expect ( " " ) ; let mut skip_rows = self . skip_rows ; let ( schema , _ ) = infer_file_schema ( & reader_bytes , self . delimiter , self . infer_schema_length , self . has_header , // we set it to None and modify them after the schema is updated None , & mut skip_rows , self . comment_char , self . quote_char , None , ) ? ; let mut schema = f ( schema ) ? ; // the dtypes set may be for the new names, so update again if let Some ( overwrite_schema ) = self . schema_overwrite { for ( name , dtype ) in overwrite_schema . iter ( ) { schema . with_column ( name . clone ( ) , dtype . clone ( ) ) } } Ok ( self . with_schema ( Arc :: new ( schema ) ) ) }
Modify a schema before we run the lazy scanning.
Modify a schema before we run the lazy scanning .
self
f
F
self
f
F