feat(sql): plan joins over summary children - #370
Merged
Conversation
zzylol
force-pushed
the
codex/sql-join-recursive
branch
from
September 10, 2026 17:30
16c3658 to
516cb8d
Compare
zzylol
added a commit
that referenced
this pull request
Sep 10, 2026
* feat(sql): plan joins over summary children (#370) * Plan relational joins over summary children * Test relational join safety boundaries * Validate relational join input boundaries * Classify relational joins in DAG viewer * fix: finalize exact state as readable values * fix: export validated edge data states * feat(sql): lower temporal and histogram planning bridges * fix(sql): validate planning bridge projections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A SQL join was retained as one
KeepPreAsapsubtree, so temporal aggregate children on each side could not independently bind to reusable summaries. For example, joining two groupedasap_rate(...)subqueries forced the complete join through exact execution.What
SummaryExpr::RelationalJointo the post-ASAP IR and executable DAG.How
Bottom-up binding plans each join input independently, then emits a relational node only when both inputs and the predicate satisfy the typed contract. DAG validation checks operator payloads, schemas, grouping, and execution phases before export. Exact accumulator finalization restores the original pre-ASAP value types, so downstream joins and aggregates consume rows rather than opaque state.
Before
A join over two summary-capable temporal aggregates remained one exact subtree.
After
Each temporal aggregate can bind independently, and the read-time join composes their typed results in the same post-ASAP DAG. Unsupported children remain exact without replacing supported siblings.
Verification
cargo fmt --all -- --checkcargo test -p asap-types post_asap::executable_dagcargo test -p asap-integration-tests --test promql_to_post_asap