Skip to content

Domain uses AST analysis, not the SQL translator - #134

Merged
austin-barrington merged 1 commit into
mainfrom
refactor/query-analysis
Nov 28, 2026
Merged

austin-barrington merged 1 commit into
mainfrom
refactor/query-analysis

Conversation

@austin-barrington

Copy link
Copy Markdown
Member

Stacked on #133. Implements docs/superpowers/plans/2026-11-03-query-analysis-module.md.

timeseriesql::analysis now holds the pure InfluxQL AST facts the domain needs:

  • output column names;
  • aggregate detection;
  • the TOP/BOTTOM/SAMPLE selector descriptor;
  • the merge column names.

domain::rollup, domain::sharding::query_merge and domain::sharding::multi_selector now import from it instead of to_clickhouse. The translator re-exports the moved items, so the generated SQL is unchanged.

The move is pure: a reviewer compared every moved body line by line, and only visibility changed. New tests pin output names, that window transforms are not aggregates, and the merge column literals.

Gate: fmt, clippy -D warnings, 883 lib tests, 373 integration tests and 54 CLI tests pass.

@cursor

cursor Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Pure refactor with re-exports and new tests; no behavioral change to query translation or merge logic intended.

Overview
Introduces timeseriesql::analysis, a backend-agnostic layer for InfluxQL AST facts (output column naming, true aggregate detection, TOP/BOTTOM/SAMPLE descriptors, and sharded-merge hidden column constants).

Domain code in rollup, sharding::query_merge, and sharding::multi_selector now imports those helpers from analysis instead of to_clickhouse, so rollup and coordinator merge logic no longer depends on the SQL translator.

The moved logic is lifted unchanged from to_clickhouse/select, aggregates, and selectors; the translator re-exports the same symbols so existing paths and generated SQL stay the same. New unit tests in analysis lock Influx-style output names, window-transform vs aggregate classification, and __bucket / __tns stability.

Reviewed by Cursor Bugbot for commit 4bd0b40. Configure here.

@cursor

cursor Bot commented Nov 4, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: bb52c930-66ad-405e-94ef-5139fa612dcb)

@austin-barrington
austin-barrington changed the base branch from refactor/code-health to main November 28, 2026 01:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved: Cursor Bugbot did not complete analysis (usage limit reached), so this is incomplete automated review rather than a clean signal. Human review is needed; no reviewers were assigned. CI Format, Clippy, and Test already passed.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

timeseriesql::analysis holds the AST facts that hold whatever the backend:
select_output_field_name (with default_field_alias / influxql_name),
select_has_true_aggregate and the aggregate/window-transform predicates,
SelectorKind, MultiSelector, BUCKET_COL and TIME_NS_COL. to_clickhouse
re-exports them, so the translator is unchanged; domain::rollup,
sharding::query_merge and sharding::multi_selector import the analysis
module instead of to_clickhouse.
@austin-barrington
austin-barrington merged commit 4cf7373 into main Nov 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant