-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace infer_schema_length by infer_schema #972
Comments
I like this, but what would we use for all rows? IIUC |
|
thanks for improving this! just share a way duckdb did.
ref: I am more than happy to take a stab at this |
👉🏼 given
/// Set the JSON reader to infer the schema of the file. Currently, this is only used when reading from
/// [`JsonFormat::JsonLines`], as [`JsonFormat::Json`] reads in the entire array anyway.
///
/// When using [`JsonFormat::JsonLines`], `max_records = None` will read the entire buffer in order to infer the
/// schema, `Some(1)` would look only at the first record, `Some(2)` the first two records, etc.
///
/// It is an error to pass `max_records = Some(0)`, as a schema cannot be inferred from 0 records when deserializing
/// from JSON (unlike CSVs, there is no header row to inspect for column names).
pub fn infer_schema_len(mut self, max_records: Option<NonZeroUsize>) -> Self {
self.infer_schema_len = max_records;
self
} |
Today infer_schema_length has an awkward API, since setting it to
nil
is used to infer all columns and0
is used to disable it.I propose:
Where true enables, false disables, and the integer configures the length. The default can be the same as today.
The text was updated successfully, but these errors were encountered: