Skip to main content

Module wire

Module wire 

Source
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:

TypeWire stringRule
FIXED/NUMBER"1.0"keep the decimal verbatim — do not divide by 10^scale
REAL/FLOATnumericparse 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
BINARYhexhex-decode
VARIANT/OBJECT/ARRAYembedded JSONpreserve as structured JSON
SQL NULLJSON nullCellValue::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§

WireError
A jsonv2 decode 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§

CellValue
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 data cell against its ColumnType. raw is None for SQL NULL.