Ecto. Adapters. ClickHouse. Expression
(clickhouse_adapter_ecto v0.2.0)
Copy Markdown
Clause and expression rendering for SELECT statements: SELECT,
FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY,
LIMIT/OFFSET, and expr/3, the general Ecto expression renderer
(literals, functions, operators, fragments).
Joins
:inner, :left, :right, :full, and :cross are supported --
everything join/4,5 and association-based join: assoc(...) queries
can produce, other than ClickHouse-specific ASOF/semi/anti/array joins
and hints:, which raise rather than being silently mishandled.
:inner_lateral/:left_lateral/:cross_lateral (Ecto's LATERAL JOIN
support) also raise, but for a different reason: ClickHouse has no
LATERAL JOIN equivalent at all, so there is no query this adapter could
ever generate for them, not just one that hasn't been implemented yet.
Unlike Postgres/MySQL, a plain ClickHouse LEFT JOIN fills an unmatched
right side with each column's type default ("" for String, 0 for
numeric types), not SQL NULL, unless the server has
join_use_nulls = 1 set. Code relying on is_nil/1 against a
left-joined column should account for this.
What's not supported
DISTINCT, selecting an entire source without an explicit field list,
window functions, set operations (union, etc), filter/2
(Ecto.Query.API documents it as Postgres-only), and any ORDER BY
direction other than :asc/:desc all raise a clear
Ecto.QueryError rather than being silently mishandled.