InfluxElixir.Client.Local.SQLExecutor (InfluxElixir v0.1.35)

Copy Markdown View Source

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 — null omission, DataFusion's comparison and cast semantics, schema errors for unknown columns, the failure shape of a cast that cannot be performed — lives here; 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.

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.

Types

fetch()

@type fetch() :: (binary() -> {:ok, [point()]} | :error)

Fetches a measurement's points, or :error when there is no such measurement.

point()

A stored point, as InfluxElixir.Client.Local keeps it.

Functions

matches_all?(point, conjunction)

Whether a point satisfies a parsed WHERE conjunction (also used by DELETE).

run(query, fetch)

@spec run(InfluxElixir.Client.Local.SQLParser.parsed_query(), fetch()) ::
  [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.