Skip to content

fix(sql): preserve nested temporal aggregates - #372

Merged
zzylol merged 1 commit into
mainfrom
fix/sql-nested-aggregate-pr371
Sep 10, 2026
Merged

fix(sql): preserve nested temporal aggregates#372
zzylol merged 1 commit into
mainfrom
fix/sql-nested-aggregate-pr371

Conversation

@zzylol

@zzylol zzylol commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Why

An outer SQL aggregate could hide an otherwise reusable inner temporal aggregate, forcing the complete nested expression through exact execution.

What

  • Preserve nested temporal aggregate structure during SQL lowering.
  • Bind the inner temporal summary independently.
  • Keep the outer aggregate as an explicit read-time operation with strict schema and execution-state validation.

How

Recursive lowering retains the inner aggregate node instead of flattening its output into an opaque leaf. The outer operator consumes the finalized readable values from that child, preserving the maintenance/read boundary.

Before

SUM(asap_rate(...)) became one exact residual subtree.

After

The rate state can be precomputed and reused, while the outer sum executes over its readout in the same DAG.

Verification

  • cargo fmt --all -- --check
  • cargo test -p asap-integration-tests --test sql_to_post_asap (11/11)
  • Full workspace CI

@zzylol
zzylol force-pushed the feat/sql-temporal-histogram branch from c94370d to b3dc404 Compare September 10, 2026 17:42
@zzylol
zzylol force-pushed the fix/sql-nested-aggregate-pr371 branch from 984897f to e59b1be Compare September 10, 2026 17:48
@zzylol
zzylol changed the base branch from feat/sql-temporal-histogram to main September 10, 2026 17:48
@zzylol
zzylol merged commit ef9ca1e into main Sep 10, 2026
4 of 7 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