mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Athena queries go straight to DuckDB, which has no json_extract_scalar, json_parse or json_format and cannot parse Trino's ARRAY<T> type syntax, so `json_extract_scalar(col, '$.a')` and `CAST(json_parse(col) AS ARRAY<JSON>)` both failed. Every query now gets DuckDB macros for json_extract_scalar (a scalar as text, NULL for an object, array, JSON null or missing path, as Trino), json_parse, json_format, json_size and is_json_scalar, with Trino's bracketed path members accepted. CAST and TRY_CAST target types are rewritten to DuckDB's syntax: ARRAY<T> and ARRAY(T) to T[], MAP<K, V> to MAP(K, V), ROW(...) to STRUCT(...). JSON result columns are reported as json and unsigned counts as bigint, as Athena types them.