feat(clickhouse): render canonical exact subtrees - #647
Merged
Merged
Conversation
…-subtree-renderer # Conflicts: # Cargo.lock # control_plane/Cargo.toml # crates/asap_types/Cargo.toml # data_plane/Cargo.toml
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.
Selected ClickHouse exact subtrees currently fail compilation unless they are unfiltered table scans. Four original o11ybench queries reach this boundary after typed Map lowering, so a valid residual aggregate cannot become an executable external dependency.
This change renders a bounded set of canonical QueryExpr operators into ClickHouse SQL: Scan predicates, Filter, Project, Aggregate, Sort and Limit. Column references resolve against each child schema, output aliases preserve column order, and scalar functions use an explicit allowlist. Native argMax/argMin use Planner's validated argument contract. Unsupported operators fail admission.
Before, a retained aggregate failed with “SQL exact cut is not a direct table scan.” After, the supported retained subtree becomes an ExternalExact relation. Composite subtrees retain their own time predicates; no parent interval is injected into independent branches. The legacy explicitly bounded bare-scan path remains supported.
Verification: four focused control-plane tests pass, covering all four original q07/q09/q12/q27 shapes, branch-local time bounds, unsupported scalar rejection and quote/backslash escaping. Planner #395 supplies validated arg-selector schema and secondary input preservation. Native process differential testing and full CI are pending; compilation is not claimed as accelerated execution.
Stacked on #646. No new QueryPlan or catalog DTO is introduced. Collection lambdas and unsupported aggregate families remain outside this renderer.