Expand description
The jsonv2 wire codec: decode a result data cell per its column type.
Every cell in a crate::response::ResultSet’s data is a JSON string
(including numbers and booleans), or JSON null. The decode is driven by the
column’s ColumnType (matched case-insensitively), never by JSON shape.
These are the load-bearing rules where connector bugs hide:
| Type | Wire string | Rule |
|---|---|---|
FIXED/NUMBER | "1.0" | keep the decimal verbatim — do not divide by 10^scale |
REAL/FLOAT | numeric | parse as f64 |
BOOLEAN | "true"/"false" | string compare, not JSON bool |
DATE | "18262" | epoch days |
TIME/TIMESTAMP_NTZ/TIMESTAMP_LTZ | "82919.000000000" | fractional epoch seconds (not nanos) |
TIMESTAMP_TZ | "<sec.frac> <offset>" | offset = minutes encoded as offset_minutes + 1440 |
BINARY | hex | hex-decode |
VARIANT/OBJECT/ARRAY | embedded JSON | preserve as structured JSON |
SQL NULL | JSON null | CellValue::Null |
The docs are internally inconsistent on the timestamp unit (one passage says
nanoseconds); this codec follows the fractional-seconds reading and is
pinned against an empirically captured live golden in
fsnow-native-snowflake-connector-w0i.13. CellValue is a neutral decoded
value; the frame crate maps it onto a dtype later.
Structs§
- Wire
Error - A
jsonv2decode failure. Carries the column name and Snowflake type plus a static reason — never the raw cell value, which may be sensitive (docs/security_model.md).
Enums§
- Cell
Value - A decoded result cell. Deliberately lossless and neutral: numerics stay as
their exact decimal strings, timestamps stay as
(seconds, nanos)pairs, and semi-structured values stay as JSON — frame materialization (a later crate) owns the dtype projection.
Functions§
- decode_
cell - Decode one
datacell against itsColumnType.rawisNonefor SQLNULL.