Executes a parsed SQL query for InfluxElixir.Client.Local.
Takes the InfluxElixir.Client.Local.SQLParser.parsed_query/0 the parser
produced and a function that fetches a measurement's points, and returns
rows in the shape InfluxDB 3's JSON responses have: string keys, time as a
DateTime, null columns omitted. Every rule the double enforces about what
the engine returns lives in the modules this one calls, in the order the
engine meets them:
InfluxElixir.Client.Local.SQLJoin— aCROSS JOINInfluxElixir.Client.Local.SQLSchema— the schema errors for a column that is not thereInfluxElixir.Client.Local.SQLTypingandInfluxElixir.Client.Local.SQLPlan— the types of the expressions and the errors the planner finds in themInfluxElixir.Client.Local.SQLGrouping— a column that is not groupedInfluxElixir.Client.Local.SQLFold— a constant the optimizer cannot fold (aCASTthat cannot be performed)InfluxElixir.Client.Local.SQLRange— aWHEREthat leaves no value (or a constant that overflows in its analysis)InfluxElixir.Client.Local.SQLCondition— the filter itselfInfluxElixir.Client.Local.SQLEval,SQLNumber,SQLCastandSQLAggregate— the valuesInfluxElixir.Client.Local.SQLSort— the order
Storage, profiles and the other query languages stay in Client.Local.
Pure over the points it is given: no ETS, no connection state.
Summary
Types
Fetches a measurement's points, or :error when there is no such measurement.
Looks up a stored column's kind from its measurement and name: the
iox::column_type::field::<type> the store registered, or nil.
A stored point, as InfluxElixir.Client.Local keeps it.
Functions
Whether a point satisfies a parsed WHERE conjunction (also used by DELETE).
Runs a parsed query. fetch returns a measurement's points, or :error
when the measurement does not exist; CTEs shadow it by name. params are
the engine's values for the query's $name placeholders (see
InfluxElixir.Client.QueryParams.engine_values/1). kinds tells an
Int64 column from a UInt64 one, which the stored integers do not; a
query that runs without it reads every integer column as Int64.
Runs the SQL that an InfluxQL query is written as. The engine's InfluxQL
planner does not fail on a WHERE that leaves a numeric column no value
(verified: it answers []), so that failure is not raised here.
Types
Fetches a measurement's points, or :error when there is no such measurement.
Looks up a stored column's kind from its measurement and name: the
iox::column_type::field::<type> the store registered, or nil.
@type point() :: InfluxElixir.Client.Local.LineProtocolParser.point()
A stored point, as InfluxElixir.Client.Local keeps it.
Functions
@spec matches_all?(point(), [InfluxElixir.Client.Local.SQLParser.where_node()]) :: boolean()
Whether a point satisfies a parsed WHERE conjunction (also used by DELETE).
@spec run( InfluxElixir.Client.Local.SQLParser.parsed_query(), fetch(), %{required(binary()) => term()}, kinds() | nil ) :: [map()] | {:error, term()}
Runs a parsed query. fetch returns a measurement's points, or :error
when the measurement does not exist; CTEs shadow it by name. params are
the engine's values for the query's $name placeholders (see
InfluxElixir.Client.QueryParams.engine_values/1). kinds tells an
Int64 column from a UInt64 one, which the stored integers do not; a
query that runs without it reads every integer column as Int64.
This is the engine's SQL: a WHERE that leaves a numeric column no value
fails as it does there (see InfluxElixir.Client.Local.SQLBounds).
@spec run_influxql(InfluxElixir.Client.Local.SQLParser.parsed_query(), fetch()) :: [map()] | {:error, term()}
Runs the SQL that an InfluxQL query is written as. The engine's InfluxQL
planner does not fail on a WHERE that leaves a numeric column no value
(verified: it answers []), so that failure is not raised here.