pub struct RecordSource<I> { /* private fields */ }Expand description
Rows from a stream of JSON records.
The source reads the first sample records ahead: their keys, in the
order first seen, are the columns, and their values decide the schema
(integer and float widen to float; disagreeing types become any;
a key some records lack, or that holds null, is nullable). A record
that is not an object is one value column. Scalars become cells as they
are (true/false as text, since Value has no boolean; whole
numbers in a float column as floats), and arrays and objects become
their compact JSON text.
Keys first seen after the sample have no column; their values are
dropped and their names kept in unknown_keys, so
a caller can say so: the first MAX_UNKNOWN_KEYS of them, so a stream
whose every record has a new key stays bounded
(more_unknown_keys says there were more).
Read everything at once (the adapters’ read) to sample every record.
Implementations§
Source§impl<I> RecordSource<I>
impl<I> RecordSource<I>
Sourcepub fn unknown_keys(&self) -> impl Iterator<Item = &str>
pub fn unknown_keys(&self) -> impl Iterator<Item = &str>
Keys seen after the sample, which have no column (so far): the first
MAX_UNKNOWN_KEYS seen, sorted.
Sourcepub fn more_unknown_keys(&self) -> bool
pub fn more_unknown_keys(&self) -> bool
Whether more keys than unknown_keys holds were
seen after the sample.