The select list of an aggregate or grouped query: DATE_BIN(...) AS alias,
AGG(expr) AS alias, the selectors, first_value / last_value, constants
and grouping columns (all verified against InfluxDB 3 Core).
A column is read by the shape only it can have, and what the engine refuses
it refuses in the engine's words: AVG(time), the InfluxQL-only FIRST() /
LAST().
A column with no alias is named as the engine names it: the function as it
was written, in lower case, over the expression with its columns qualified
by the table or its alias (sum(rvt.v * Int64(2)), count(*),
count(DISTINCT rvt.h), first_value(rvt.v) ORDER BY [rvt.time ASC NULLS LAST], selector_first(rvt.v,rvt.time)[value], date_bin(...)). A name
that depends on which side of a CROSS JOIN holds a column is refused by
name, and so is a cast, whose place in a name the double does not model.
Summary
Types
Plain aggregates; :stddev/:var are the sample forms, as in InfluxDB.
One column of an aggregate or grouped select list.
Functions
Whether a text calls an aggregate function.
Whether a text selects an aggregate or groups: a DATE_BIN, a GROUP BY
(a grouped query without an aggregate still gives one row per group), or a
call of an aggregate or of an InfluxQL-only selector.
A constant select item as {expression, name} (0.0 is {{:lit, 0.0}, "Float64(0)"}), or nil when the item is not a constant. A name that
cannot be written is nil.
A column name as written (a word, or a quoted identifier) as the name it holds.
The output name of select item col: its alias_name, else the name
default writes for it. A default that throws :unrenderable is a
refusal by name.
The aggregate SELECT list as columns, or the first column's error.
qualifier is the table, or its alias, that names a column in an unaliased
item's name; nil when the table is joined.
A select item as {body, alias}: the text before a final AS name and the
name (a quoted one without its quotes), or {item, nil} when the item has
no alias.
Types
@type aggregate() ::
:avg
| :sum
| :count
| :min
| :max
| :median
| :stddev
| :stddev_pop
| :var
| :var_pop
Plain aggregates; :stddev/:var are the sample forms, as in InfluxDB.
@type column() :: {:time_bucket, binary()} | {:aggregate, aggregate(), InfluxElixir.Client.Local.SQLExpr.t(), binary()} | {:count_star, binary()} | {:count_distinct, binary(), binary()} | {:ordered_aggregate, :first | :last, binary(), binary(), binary()} | {:selector, :first | :last | :min | :max, binary(), binary(), :value | :time | :struct, binary()} | {:grouping_column, binary(), binary()} | {:constant, term(), binary()}
One column of an aggregate or grouped select list.
Functions
Whether a text calls an aggregate function.
Whether a text selects an aggregate or groups: a DATE_BIN, a GROUP BY
(a grouped query without an aggregate still gives one row per group), or a
call of an aggregate or of an InfluxQL-only selector.
@spec constant(binary()) :: {InfluxElixir.Client.Local.SQLExpr.t(), binary() | nil} | nil
A constant select item as {expression, name} (0.0 is {{:lit, 0.0}, "Float64(0)"}), or nil when the item is not a constant. A name that
cannot be written is nil.
A column name as written (a word, or a quoted identifier) as the name it holds.
The output name of select item col: its alias_name, else the name
default writes for it. A default that throws :unrenderable is a
refusal by name.
The aggregate SELECT list as columns, or the first column's error.
qualifier is the table, or its alias, that names a column in an unaliased
item's name; nil when the table is joined.
A select item as {body, alias}: the text before a final AS name and the
name (a quoted one without its quotes), or {item, nil} when the item has
no alias.