Function polars_io::csv::read_impl::to_batched_owned
source · pub fn to_batched_owned(
reader: CsvReader<'_, Box<dyn MmapBytesReader>>,
schema: SchemaRef
) -> OwnedBatchedCsvReaderAvailable on crate feature
csv-file only.Examples found in repository?
src/csv/read.rs (line 425)
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
pub fn batched(mut self, schema: Option<SchemaRef>) -> PolarsResult<OwnedBatchedCsvReader> {
match schema {
Some(schema) => Ok(to_batched_owned(self, schema)),
None => {
let reader_bytes = get_reader_bytes(&mut self.reader)?;
let (inferred_schema, _, _) = infer_file_schema(
&reader_bytes,
self.delimiter.unwrap_or(b','),
self.max_records,
self.has_header,
None,
&mut self.skip_rows_before_header,
self.skip_rows_after_header,
self.comment_char,
self.quote_char,
self.eol_char,
self.null_values.as_ref(),
self.parse_dates,
)?;
let schema = Arc::new(inferred_schema);
Ok(to_batched_owned(self, schema))
}
}
}