Gives a SQL query's expressions the types the engine gives them, for
InfluxElixir.Client.Local.
The store keeps an integer field as an integer whether it was written as
Int64 (5i) or UInt64 (5u) and registers which, per column. An
expression has to know: u / 2 is a decimal division of a UInt64 by an
Int64, u + u wraps at 2^64, -u is a planning error. retype/2 marks
each read of an unsigned column in an expression as
{:uint_col, name} (see InfluxElixir.Client.Local.SQLEval), once per
query, before anything evaluates it.
A CTE's rows hold the values its query computed: an expression's result
carries its type, and unsigned_outputs/3 names the columns that pass an
unsigned column through unchanged, which the executor tags in the CTE's
rows so the next query reads them as UInt64 too.
Summary
Types
Says whether a column is UInt64.
Functions
Refuses a CTE whose select list casts to a narrow integer (CAST(x AS INT)
is an Int32, SMALLINT an Int16, TINYINT an Int8): the rows of a
CTE are read back as Int64, so the next query would wrap at the wrong
width.
The query with each read of an unsigned column in an expression retyped.
The output columns of a (CTE) query that are an unsigned column passed
through as it is. columns are the query's output columns in order.
Types
Functions
@spec check_cte_outputs(InfluxElixir.Client.Local.SQLParser.parsed_query()) :: :ok | {:error, InfluxElixir.Client.Local.SQLError.t()}
Refuses a CTE whose select list casts to a narrow integer (CAST(x AS INT)
is an Int32, SMALLINT an Int16, TINYINT an Int8): the rows of a
CTE are read back as Int64, so the next query would wrap at the wrong
width.
@spec retype(InfluxElixir.Client.Local.SQLParser.parsed_query(), unsigned()) :: InfluxElixir.Client.Local.SQLParser.parsed_query()
The query with each read of an unsigned column in an expression retyped.
@spec unsigned_outputs( InfluxElixir.Client.Local.SQLParser.parsed_query(), [binary()] | nil, unsigned() ) :: MapSet.t(binary())
The output columns of a (CTE) query that are an unsigned column passed
through as it is. columns are the query's output columns in order.