Skip to content

Execute typed SQL grouping through SummaryStore - #641

Merged
zzylol merged 12 commits into
mainfrom
feat/clickhouse-map-transport
Sep 11, 2026
Merged

zzylol merged 12 commits into
mainfrom
feat/clickhouse-map-transport

Conversation

@zzylol

@zzylol zzylol commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

SQL summaries grouped by native ClickHouse Map(String, String) columns could be planned but could not be materialized or returned through the shared execution path. This change derives typed source grouping from the selected Planner DAG and carries each column as one group value through backfill, SummaryStore, and relational readout.

The existing shared grouping projection owns the versioned, lossless group encoding. Its version participates in catalog semantics and state identity, preventing reuse of previously flattened group state. ClickHouse exact leaves and local Arrow results preserve Map entry order, duplicate keys, and nullable values; JSON and TSV rendering retain those entries.

Before: SELECT labels, max(value) ... GROUP BY labels failed automatic publication or fell back during readout. After: automatic planning installs the grouped summary, and a real process test returns the original values after source rows have been removed. Existing SUM/count hybrid cases retain ordinary exact DAG dependencies.

Verification: 87 shared tests, 728 control-plane tests, and all 23 ClickHouse runtime tests pass. The previous full data-plane run passed 1111/1112; its one stale grouping fixture was corrected and included in the passing focused suite. The final-head real ClickHouse process differential passed in 5.55 seconds, including original arithmetic timestamp bounds and source deletion after backfill. Independent source review passed at c825e80.

A separate original 27-query run on 12,236,002 samples recorded 3 warm queries, 18 successful exact fallbacks, and 6 native/fallback memory-limit failures. All 21 successful outputs have equal decoded JSON metadata and data. This is correctness coverage, not a new performance result or proof for arbitrary duplicate-key inputs.

Nullable group columns, floating/timestamp grouping, and computed grouping expressions remain unsupported. TSV supports integer groups; JSON containing 64-bit integers, nested Map timestamps, or client output-format overrides falls back until its output policy is explicit. This stack depends on typed grouping (#637), runtime fixes (#617), and safe SQL count inputs (#632); the isolated implementation diff starts at 5c2f038.

@zzylol
zzylol marked this pull request as ready for review September 11, 2026 03:52
@zzylol
zzylol changed the base branch from stack/clickhouse-map-dependencies to main September 11, 2026 13:17
@zzylol
zzylol merged commit f1f24e3 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