Skip to content

Commit 7cbb443

Browse files
authored
minor: add builder setting NdJsonReadOptions::schema_infer_max_records (#18920)
Noticed this was missing, meaning would have to do something awkward like: ```rust ctx.read_json( "/Users/jeffrey/Downloads/a.json", NdJsonReadOptions { schema_infer_max_records: 2, ..Default::default() }, ) .await? .show() .await?; ``` Add this builder method to be consistent with the other options and be more ergonomic to use.
1 parent 3ba7350 commit 7cbb443

File tree

1 file changed

+6
-0
lines changed
  • datafusion/core/src/datasource/file_format

1 file changed

+6
-0
lines changed

datafusion/core/src/datasource/file_format/options.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,12 @@ impl<'a> NdJsonReadOptions<'a> {
523523
self.file_sort_order = file_sort_order;
524524
self
525525
}
526+
527+
/// Specify how many rows to read for schema inference
528+
pub fn schema_infer_max_records(mut self, schema_infer_max_records: usize) -> Self {
529+
self.schema_infer_max_records = schema_infer_max_records;
530+
self
531+
}
526532
}
527533

528534
#[async_trait]

0 commit comments

Comments
 (0)