Skip to content

Commit

Permalink
csv::infer_file_schema remove redundant ref (#1776)
Browse files Browse the repository at this point in the history
* csv::infer_file_schema remove redundant ref

* Fix compile
  • Loading branch information
tustvold authored Jun 2, 2022
1 parent c1a91dc commit 1a64677
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions arrow/src/csv/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub struct ReaderOptions {
/// Return inferred schema and number of records used for inference. This function does not change
/// reader cursor offset.
pub fn infer_file_schema<R: Read + Seek>(
reader: &mut R,
reader: R,
delimiter: u8,
max_read_records: Option<usize>,
has_header: bool,
Expand All @@ -136,12 +136,13 @@ pub fn infer_file_schema<R: Read + Seek>(
}

fn infer_file_schema_with_csv_options<R: Read + Seek>(
reader: &mut R,
roptoins: ReaderOptions,
mut reader: R,
roptions: ReaderOptions,
) -> Result<(Schema, usize)> {
let saved_offset = reader.seek(SeekFrom::Current(0))?;

let (schema, records_count) = infer_reader_schema_with_csv_options(reader, roptoins)?;
let (schema, records_count) =
infer_reader_schema_with_csv_options(&mut reader, roptions)?;
// return the reader seek back to the start
reader.seek(SeekFrom::Start(saved_offset))?;

Expand All @@ -155,7 +156,7 @@ fn infer_file_schema_with_csv_options<R: Read + Seek>(
///
/// Return infered schema and number of records used for inference.
pub fn infer_reader_schema<R: Read>(
reader: &mut R,
reader: R,
delimiter: u8,
max_read_records: Option<usize>,
has_header: bool,
Expand All @@ -170,7 +171,7 @@ pub fn infer_reader_schema<R: Read>(
}

fn infer_reader_schema_with_csv_options<R: Read>(
reader: &mut R,
reader: R,
roptions: ReaderOptions,
) -> Result<(Schema, usize)> {
let mut csv_reader = Reader::build_csv_reader(
Expand Down

0 comments on commit 1a64677

Please sign in to comment.