Skip to content

feat(clickhouse): render canonical exact subtrees - #647

Merged
zzylol merged 8 commits into
mainfrom
feat/clickhouse-exact-subtree-renderer
Sep 11, 2026
Merged

zzylol merged 8 commits into
mainfrom
feat/clickhouse-exact-subtree-renderer

Conversation

@zzylol

@zzylol zzylol commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

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.

@zzylol
zzylol changed the base branch from feat/clickhouse-map-scalars to main September 11, 2026 14:15
@zzylol
zzylol marked this pull request as ready for review September 11, 2026 14:17
…-subtree-renderer

# Conflicts:
#	Cargo.lock
#	control_plane/Cargo.toml
#	crates/asap_types/Cargo.toml
#	data_plane/Cargo.toml
@zzylol
zzylol merged commit 2fee459 into main Sep 11, 2026
1 check 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