pub struct NativeSchema { /* private fields */ }Expand description
The immutable, clickhouse-free column template a NativeEncoder is
built from: the validated, config-ordered (name, parsed type, raw type string) columns plus the validation mode they were fetched under, which
the encoder’s first-record struct check applies.
Implementations§
Source§impl NativeSchema
impl NativeSchema
Sourcepub fn from_row_schema(
schema: &RowSchema,
) -> Result<Arc<NativeSchema>, NativeError>
pub fn from_row_schema( schema: &RowSchema, ) -> Result<Arc<NativeSchema>, NativeError>
Build from a validated RowSchema (fetched from system.columns),
failing fatally for any column whose type the encoder cannot lay out.
The schema’s validation mode carries over to the encoder’s
first-record check: under validate_schema: full each field’s type
class is checked against the live column type, so a wire-wrapper
scale that disagrees with the table’s declared precision
(DateTime64Millis into DateTime64(6)) fails on the first record
instead of silently landing wrong timestamps.
Sourcepub fn from_columns(
specs: &[(&str, &str)],
) -> Result<Arc<NativeSchema>, NativeError>
pub fn from_columns( specs: &[(&str, &str)], ) -> Result<Arc<NativeSchema>, NativeError>
Build a schema from (column name, ClickHouse type string) pairs,
e.g. [("id", "UInt64"), ("tags", "Array(LowCardinality(String))")].
The normal path is ClickHouseSink::native_schema,
which fetches the real types from system.columns. Use this only when
the schema is known statically — the type strings must match the
server’s column types exactly, or the server will reject the block.
The first-record check runs at name level only (there is no fetched
truth to compare type classes against).