Skip to main content

Module query

Module query 

Source
Expand description

A real, bounded SQL handler for Amazon Timestream Query.

A faithful Timestream SQL engine (the full Trino-derived time-series dialect) is out of scope. This module implements a genuine interpreter for the query shapes the SDK, e2e, and conformance exercise, over the points ingested by WriteRecords:

  • SELECT * FROM "db"."table" – every stored point as a row, with AWS-shaped ColumnInfo/Datum typing: one VARCHAR column per dimension name, measure_name (VARCHAR), a measure_value::<type> column per measure value type present, and time (TIMESTAMP).
  • SELECT COUNT(*) FROM "db"."table" – a single BIGINT row.
  • optional WHERE time <op> ago(<n><unit>) time filter.
  • optional ORDER BY time [ASC|DESC].
  • optional LIMIT <n>.

Anything outside this subset returns QueryError::Validation naming the unsupported construct, so a caller never gets a wrong or silently-empty success for a query the engine cannot actually run.

Structs§

Plan
A parsed, executable query plan.
QueryResult
The materialized result of a plan: AWS-shaped ColumnInfo list and Row list, both ready to drop straight into the Query response JSON.

Enums§

CmpOp
A comparison operator in a WHERE time <op> ... clause.
Projection
What the SELECT list projects.
QueryError
Why a query could not be planned/run.

Functions§

execute
Execute a Plan against a table’s ingested points, producing the AWS-shaped ColumnInfo + Row lists.
parse_query
Parse a Timestream SELECT into an executable Plan, or return a QueryError::Validation naming the unsupported construct.