Parses and transforms ClickHouse gRPC Result messages.
Summary
Functions
Converts a gRPC Result message to a Huginn.Clickhouse.Result struct.
Converts a gRPC Result message, inheriting :format and :columns from an
earlier message in the same streaming response.
Merges multiple results from streaming responses.
Parses raw output bytes based on format.
Converts rows to a list of maps using column names as keys.
Types
@type log_entry() :: %{ time: non_neg_integer(), level: atom(), source: String.t(), text: String.t() }
@type progress() :: %{ read_rows: non_neg_integer(), read_bytes: non_neg_integer(), total_rows_to_read: non_neg_integer(), written_rows: non_neg_integer(), written_bytes: non_neg_integer() }
@type stats() :: %{ rows: non_neg_integer(), blocks: non_neg_integer(), allocated_bytes: non_neg_integer(), rows_before_limit: non_neg_integer() }
Functions
Converts a gRPC Result message to a Huginn.Clickhouse.Result struct.
Converts a gRPC Result message, inheriting :format and :columns from an
earlier message in the same streaming response.
ClickHouse populates output_format and output_columns only on the first
Result of a stream; later chunks leave both empty. Parsing such a chunk in
isolation would fall through to the unknown-format clause of parse_output/3
and collapse the whole chunk into a single opaque row, so streaming callers
thread the values established by the first chunk.
Merges multiple results from streaming responses.
Parses raw output bytes based on format.
columns is the list of column/0 maps parsed from the gRPC result. It is
only consulted for JSONEachRow, where JSON object key order is not
guaranteed to match the column order — values are extracted in column order so
rows line up with columns. When columns is empty (the default, and the
case for the 2-arity form), JSONEachRow falls back to the order returned by
Jason.
Converts rows to a list of maps using column names as keys.