Skip to main content

Module value

Module value 

Source
Expand description

Per-arrow-type value formatting for both CSV and JSONL.

CSV rules:

  • Null → empty cell.
  • Complex types (list, struct, map, binary, duration, interval, union, …) → error.
  • Binary & binary-view types → error (user should use JSONL).
  • Timestamps, dates, times → ISO-8601 strings.
  • Floats: NaN, inf, -inf.
  • Decimals: standard decimal-point string.

JSONL rules:

  • Null → null.
  • Binary → string of \xHH escapes (lowercase hex).
  • Timestamps → ISO-8601 (with tz suffix if zoned).
  • Floats: "NaN", "Infinity", "-Infinity" as JSON strings (numbers otherwise).
  • Decimals → raw unscaled integer (may exceed JavaScript’s safe range).
  • List / Struct / Map / FixedSizeList → JSON array / object.
  • Dictionary → decoded to its value type.

Constants§

BINARY_PLACEHOLDER
Literal placeholder used in CSV and JSONL when --binary-format none is set.

Functions§

csv_cell
Format a single cell for CSV. Returns None for null (writer emits an empty field).
json_value
Format a single cell as a serde_json::Value.
table_cell
Format a single cell for table output. Strictly more permissive than CSV: primitives render exactly the same way, but nested types (lists, structs, maps, …) fall through to the JSONL renderer and are serialised compactly. Null becomes an empty string.
validate_csv_schema
Reject types that cannot be represented losslessly in CSV. All four binary flavors are accepted under any --binary-format: the value is rendered as hex, base64, or the literal “BINARY_DATA” placeholder.