Repository navigation
Add bucketed TimeSeries samples and bounded native PromQL execution - #121216
skuznetsov-clickhouse wants to merge 56 commits into
Conversation
A row of the samples tables now holds the samples of one series within one time bucket: `samples` (a sorted array merged by `timeSeriesGroupArray`), `bucket`, `min_time`, `max_time`, in an `AggregatingMergeTree` ordered by `(id, bucket)`. The bucket steps are set by `samples_bucket_step_seconds` and `recent_samples_bucket_step_seconds`. Tables of older versions are read-only, PromQL requires version 2. `timeSeriesSelector` returns `id, time_series`, the new function `timeSeriesSliceSortedArray` cuts an interval out of a bucket.
The generated selector left cheap bucket and time-range predicates in `WHERE`, allowing predicate pushdown to materialize the large samples array before rows were discarded. Generate an explicit `PREWHERE` when the samples storage can safely move conditions there, and retain `WHERE` for unsupported and wrapper storages such as `Distributed` over `Memory`. Verified with an incremental RelWithDebInfo build, red/green stateless test 05175 on the dev VM, exact reference comparison, scale and concurrency benchmarks, and an approved local hostile review. ClickHouse CI and sanitizer coverage remain pending. Related: #117344
Add a bounded native range-aggregation fragment that composes with the existing SQL PromQL plan, including ordered selector reads, tag publication, lane-local partial aggregation, and pre-execution capability routing. Keep unsupported and short range queries on SQL, propagate native failures without replay, and add private-preview controls plus focused unit, stateless, and integration coverage. Verified with arm64 and x86 RelWithDebInfo builds, focused unit and stateless oracles, the Prometheus API integration selector, and same-host ClockBench XL adaptive A/B. The frozen C02 query improved latency by 13.7% and peak RSS by 67.9%, while S08 and S17 routed back to SQL. General PromQL performance and a product-default cost model remain unproved.
Hybrid routing admitted fragments before checking the vector-grid storage contract, so unsupported ordered reads could surface LOGICAL_ERROR instead of falling back to SQL. Check capability before registering the external fragment and remove the unused strict dictionary/barrier prototype while retaining duplicate-tag guards on the executed path. Verified on the devserver with a RelWithDebInfo build, 14 focused unit tests, the H0/H1 unordered-storage fallback stateless test, and the positive native-routing integration test. Remaining scope is the exact supported native shapes and ordered samples layout; other shapes fall back to SQL.
Hybrid admission could rescan tags, accept ambiguous full-tag mappings, and count parallel lane states as separate output groups. Materialize and reuse the exact identifier set, fail closed to SQL for duplicate physical series identities, and enforce one query-wide distinct output-group cap while releasing aggregate states promptly. Verified on the devserver with a RelWithDebInfo build, 14 focused unit tests, and stateless tests 05176 through 05178. ASan, TSan, stress, and ClockBench remain follow-up gates.
Add bounded native PromQL range-rate and parallel fused two-rate execution for exact admitted shapes while preserving SQL parents and fail-closed semantics. Move raw sample slicing and scoped block controls into the generated plan; keep query-wide series, grid, and sample budgets and cross-lane matching. Reject oversized physical sample rows from the offsets subcolumn before materializing raw arrays. Verified the ClickHouse and unit-test targets, 46 focused PromQL unit tests, and stateless tests for standalone rate, range-sum block caps, fused D06 accounting, and the raw-row admission guard. The final Luna Max review timed out after 1200 seconds without a verdict.
Resolve the TimeSeries v6 samples-column transition while preserving the internal timeSeriesSelector schema and the pre-v6 fallback. Verified with the focused Debug build, 49/49 PromQL unit tests, and 9/9 new PromQL and TimeSeries stateless tests.
Separate native aggregation output limits from intermediate vector-matching bounds. Apply rate-series and cumulative per-series sample admission to direct `sum by (rate(...))` roots, and document the hybrid SQL-parent limit boundary. Add regressions for samples split across chunks and for hybrid two-rate groups. Verified by the `clickhouse` and `unit_tests_dbms` build, 74 focused unit tests, and 9 stateless tests.
|
Workflow [PR], commit [2968285] Summary: ❌
AI ReviewSummaryAdds version 11 bucketed Findings❌ Blockers
Tests
Final VerdictStatus: ❌ Block. Preserve row cardinality across projections, handle inherited retention/partition expressions during the schema transition, and make the new aggregate discoverable by the documentation generator. |
The style checker rejected the new native PromQL settings because their history entries were placed under 26.9 while the branch version is 26.10. Move the ten entries to the 26.10 block without changing their values or compatibility behavior. Verified with the repository settings-history parser/check, git diff --check, and an independent review.
The native PromQL path still materialized large per-series sample arrays and paid for intermediate sorted merges, which limited the D06 latency and memory gains. Stream rate-to-grid aggregation, fuse the ordered MergeTree merge with one- and two-rate consumers, add an experimental typed samples codec, and cap automatic fused D06 parallelism at the measured four-lane resource optimum while preserving an explicit override. Verified with the focused unit/stateless coverage, an x86 devserver build, exact-result ClockBench XL ABBA runs, zero spills, and invariant source parts. Remaining risk is broader ClockBench coverage and sanitizer/concurrency validation.
Master row-layout codec tests implicitly selected the latest TimeSeries version, so the v6 bucketed default removed timestamp/value and made them fail. Pin row-layout-specific tests to version 5 and apply the exact arm_tidy iterator and raw-string fixes. Verified by rebuilding clickhouse and the PromQL parser test object, then running the three affected stateless tests: 3/3 passed. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=2a3477f539991f65ecc55eaf30647cc29cf7fd58&name_0=PR PR: #121216
Adapt native PromQL planning and TimeSeries bucketed storage to the current TimeSeries version, timestamp/result type APIs, versioned metric-family columns, and rate-function test interfaces. Preserve adaptive SQL fallback and native storage fusion. Verified with the ClickHouse target build, unit_tests_dbms build, and 96 focused PromQL/TimeSeries unit tests.
Preserve the PromQL compatibility settings and the new analyzer CTE redefinition setting while updating the PR branch to master.
Declare the error codes used directly by the streaming rate header so the C++ style check can validate the header independently. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=2fe974a2bd7513bbcfdafef8ffb4f18cab541bbc&name_0=PR&name_1=Style%20check Related: #121216 Verification: git diff --cached --check; local clickhouse rebuild and refreshed CI are pending.
The PR added a second <Common/typeid_cast.h> include in `CompressionFactory.cpp`, which clang-tidy rejects. Remove only the duplicate and retain the original include. Verification: the local unit_tests_dbms target builds; ARM CI rerun is pending. Related: #121216
Bucketed samples moved to v7, but stateless and normalizer tests still expected the v7 layout under v6. The new index granularity defaults also leaked into explicit v6 table creation. Keep the historical v6 granularity, exercise the default v7 layout, and correct the versioned SQL expectations. Verification: unit_tests_dbms builds; 23/23 normalizer tests pass; 32/33 TimeSeries unit tests pass (one build-conditional skip). Local 04648 output matches its full reference; non-replicated 05028 output matches its reference. Replicated stateless and ARM CI remain pending. Related: #121216 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=6b6d82ec2424513ee07ef8d5b72e09fdf67b1f13&name_0=PR&name_1=Fast%20test
The v7 selector returns sample arrays, so filtering stale markers at row level no longer removes individual stale samples. Filter the tuples within each array; retain the existing row filter for v6. Refresh selector and metadata expectations affected by v7 and add a stale-vs-ordinary-NaN regression test. Validation: local build succeeded; 24 targeted stateless tests matched their references, including the new stale-marker test and both range-bound tests. The text-index test still requires CI server-harness execution. Independent staged-diff review found no blocker. The DESCRIBE golden output intentionally contains TSV trailing tabs. Related: #121216
Resolve the SettingsChangesHistory.cpp conflict by keeping the native PromQL setting history and the incoming 26.10 qbit/validate_mutation_query entries. The GitHub PR was conflicting and could not run CI at 0090800; this merge restores a single master-based change set for the exact-SHA ARM build. Validation: merge index has no unmerged entries; independent staged-resolution review accepted. The v7 selector fix on the first parent built and passed 24 targeted tests. Full post-merge CI and ARM binary remain pending.
The one-stream D06 native route retained a Sparse(DateTime64) bucket with a typed insert into a regular DateTime64 column. That violated the concrete-column contract and corrupted the previous bucket at a chunk boundary. Unwrap sparse and const columns before retaining rate keys in both native rate transforms. Add serial D06 and sparse-bucket rate regressions, and disable serialized query plans in native-route admission tests. Local ARM Debug build and focused 05176, 05179, and 05180 tests pass; ASan/TSan CI and hot-path overhead remain to be checked. Related: #121216
Reject bucketed sample layouts that can discard samples or retain arbitrary time bounds during merges. Apply the PromQL block-size cap to direct SQL HTTP queries, and strip v7-only codec settings from older or TTL-disabled TimeSeries definitions. Verification: local clickhouse build; 05243, 05140 and 05019 stateless outputs matched references; negative DDL probes returned expected error codes. HTTP integration and sanitizer CI remain to run. Related: #121216
A v7 samples target rebound by ATTACH or RESTORE could have raw columns under AggregatingMergeTree or a row-discarding engine, silently losing samples after merges. Validate the actual engine and column types at CREATE, full ATTACH, RESTORE-before-insert, and target resolution; keep metadata replay and backup of existing unsafe tables possible. Verification: local Debug ClickHouse build; focused stateless 05243 pass; 05140, 05141, 05176, 05179, and 05180 pass on isolated server; direct unsafe ATTACH/RESTORE/read/write rejected. 05175 harness remains unverified locally because the isolated server lacks its Distributed test cluster. Remaining risk: Distributed remote-engine safety cannot be verified locally, and concurrent target ALTER may race the validation-to-insert gap. These need a separate invariant or documented trust boundary. Related: #121216
Master added TimeSeries deduplication caches as version 7 while the PR independently used version 7 for bucketed samples. Preserve the master row layout and cache semantics at version 7, move bucketed samples to version 8, and merge both write paths, settings, documentation, and focused tests. Verification: resolved index has no unmerged entries or conflict markers; focused staged diff passes git diff --check; affected shell test passes bash -n; independent source review found no blocking issue. Build, runtime tests, mixed-version compatibility, and CI remain pending. Experimental PR-version-7 bucketed data must not be opened as merged version 7.
The default `TimeSeries` version is now 8: two references still expected 7, while the evaluation-time test supplied an external version-7 samples layout without pinning its version. Repeated `05255` copies also clear the same global query-cache tag concurrently. Update the v8 expectations, cover versions 7 and 8 in `04612`, pin the legacy external layout in `05229`, and run `05255` sequentially. Verification: staged diff check, bash syntax check for `05229`, and direct source review of version and test-runner behavior. Exact-head runtime tests remain unrun because this isolated worktree has no runnable matching binary; CI must validate the fix. Related: #121216
The stateless test put version after the external DATA/TAGS clauses, where CREATE interpreted it as a query setting and failed with UNKNOWN_SETTING. Move the engine setting directly after TimeSeries, matching existing parser tests. Verification: bash -n and git diff --check passed. Exact-head stateless execution was unavailable locally; CI rerun is pending.
Bring master 4e32e13 into the isolated PoC branch without rewriting existing history. Resolve the `FailPoint` and PromQL parser overlaps by preserving both upstream additions and private native-path coverage. Keep the upstream row-layout recovery fixture at `version = 7` with explicit retention, and preserve the separate bucket-layout recovery test. Structural validation: conflict-marker scan, fixture shell syntax, failpoint/parser-test union checks, and patch application checks passed. Full build, parser/Keeper runtime, compatibility, and performance gates remain unrun on this merged source. Dirty-candidate overlays follow in separate local changes. No external push or publication is authorized. Related: #121216
Keep this PoC as a Draft while the remaining runtime and compatibility gates are open. Share typed selector bounds and handle empty ranges before starting selectors. Add planning-time workload admission and read/work-aware automatic lanes with a manual override; do not replay native errors in SQL. Preserve exact opt-in `sumPromQL` states across partial aggregation and merging, transfer single-block ownership safely, retain multiblock copies, and document the versioned serialized state. Preserve timestamp bucketed carriers and add SQL, numeric, admission and lifetime regression coverage. Verification: `git diff --check`; all 53 checkpoint paths hash-match the composite frozen F1/F3 manifests. Recorded F1/F6 SQL/control and 76-case unit evidence, plus F3 18/18 suite and 40/40 repeat coverage, apply to their exact source/ELF receipts. These are successive snapshots, not a fresh combined full matrix. Current extended lifetime sanitizer, concurrent cancellation/TSan, hard-limit/RSS, mixed-version, performance and CI gates remain open. Requested-byte balance is not a peak-memory guarantee. Related: #121216
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Merge master at 352c5ea into the 29e1abf draft checkpoint without rewriting either history. Both branches used persisted `TimeSeries` version 8 for different sample layouts. Preserve upstream row versions through 8, reserve version 9 for bucketed samples, and reject proven legacy private-v8 bucket targets rather than silently reinterpret or migrate their metadata. Retain upstream optional `TIME RANGES`, matcher pushdown and typed codec validation while porting the private native selector and planner paths. Update source documentation and version-specific DDL/query fixtures. Verification: focused Darwin arm64 Debug object builds and static fixture checks passed. No unresolved index entries or conflict markers remain. Full linked runtime, sanitizer, mixed-version and performance tests remain unrun; keep this PoC a draft. Existing native-path review findings are not claimed fixed by this integration. Related: #121216
The master merge changed the merging algorithm input container to the allocator-aware `Inputs` alias. Use that alias for `current_inputs` so the native PromQL merging algorithm follows the current API. Validation: the ARM macOS Debug `clickhouse` target builds successfully; eight focused stateless fixtures pass with the resulting binary. Sanitizers and exact-head CI remain unrun. Related: #121216
The fused range-sum path passed stale markers into rate state accumulation, unlike the SQL path. Filter only exact Prometheus stale markers before `PromQLRangeRateTransform` accumulation while retaining ordinary NaNs. Apply sample limits to the original physical rows before filtering. Add a deterministic SQL/native comparison covering stale-only ranges, ordinary NaNs, sample limits, and multi-lane partial-group merging. Validation: the fresh ARM macOS Debug build passes the new fixture and seven related stateless fixtures. Sanitizers and exact-head CI remain unrun. Related: #121216
With eager or reordered PREWHERE evaluation, an oversized row outside the query time range could raise an exception. Include all time and series eligibility predicates inside the throwing sample-limit condition while retaining the outer predicates for index filtering. Add a one-granule fixture covering four PREWHERE policies with eager evaluation and proving eligible oversized rows still raise the exception. Validation: the fresh ARM macOS Debug build passes both new fixtures and six related fixtures. Sanitizers and exact-head CI remain unrun. Related: #121216
Replace the disallowed storage cast with `castStorage` while preserving direct-storage eligibility and avoiding deferred-table loading. Track the range-rate source-state vector and make pointer/constness declarations accepted by clang-tidy without changing the numerical algorithm. Move twelve unreleased setting-introduction records to `26.11`, without changing defaults. Pin the row-TTL fixture to `TimeSeries` version 8 because its `timestamp` column is absent from the default bucketed layout. Verification: relevant objects, lifetime-gtest object and fresh Debug binary built on macOS arm64; settings-history and focused style checks passed; nine selected SQL fixtures passed. Full gtest, Linux ARM tidy, sanitizers and performance were not run. Local dirty dependency checkouts are not included in this commit and limit clean-CI parity. The newer-master Fast fixture `05331_create_as_time_series_inner_engine_credentials.sh` remains outside this branch and requires separate CI-merge-context validation. Related: #121216 CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=4d244f7093ab3008348e95f0a82c5faa9255599b&name_0=PR&name_1=Style%20check CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=4d244f7093ab3008348e95f0a82c5faa9255599b&name_0=PR&name_1=Fast%20test CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=4d244f7093ab3008348e95f0a82c5faa9255599b&name_0=PR&name_1=Build%20(arm_tidy%2C%201%2F4) CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=4d244f7093ab3008348e95f0a82c5faa9255599b&name_0=PR&name_1=Build%20(arm_tidy%2C%204%2F4)
Integrate master at 83d26f0 with an ordinary merge; do not rebase or rewrite the feature history. Upstream `TimeSeries` version 9 uses scalar samples with UTC partitioning, while the private PoC assigned that version to bucketed samples. Move the private bucket layout to version 10, preserve scalar versions 0 through 9, and reject legacy bucket-shaped definitions before normalization can hide their shape. Keep metadata replay available, but reject incompatible external targets when they are resolved for access. Do not migrate or open old data. Pin the source and destination of the `05331` credential fixture to scalar version 8 without changing its permission oracle. Correct the bucketed `CREATE AS` expected version and resolve relative disposable metadata paths. Local review also exposed unchecked bucketed steps and recent-retention addition. Validate steps and check the sum against `Int64` before arithmetic, including source definitions before destination overrides, full user `ATTACH`, resolved samples targets and selector admission. Preserve scalar and metadata- replay contracts; document the bound. Regenerate source-layout defaults for `CREATE AS` while preserving distinct custom scalar engine settings. Align the published `timeSeriesSelector` column description with the version-10 bucket layout boundary. Keep a bucketed owner's declared ID type independent of its resolved `Samples` and `RecentSamples` targets. A replaced `UInt32` target could otherwise accept a recorded `UInt64` owner and narrow high IDs on `INSERT`. Read only durable inner-column/setting declarations and pass that nullable contract to both target guards. For legacy all-external metadata without a recorded ID, also compare all ID-bearing source and bound `INSERT` headers before constructing converting actions or consuming rows. Reject mismatches in `Tags`, `TimeRanges`, `Samples` and `RecentSamples` without partial writes. Do not rewrite `ATTACH` metadata or infer defaults from live targets. Read safety for historically inconsistent IDs and all concurrent DDL races remain unverified. Regenerate the `sumPromQL` aggregate documentation and fix the generator's explicit output routing. Align the DDL-race fixture with version 10 and pin the replica-recovery fixture's existing topology with `store_time_ranges=0`. Validation: rebuilt `clickhouse` and `unit_tests_dbms` with macOS ARM64, Clang 22.1.8, Debug; 208 selected normalizer, exact-sum and PromQL gtests and 15 selected stateless fixtures passed, including the complete `05331` credential oracle. The documentation write/check and focused routing test passed. A separate SQL probe rejected the old version-9 bucket fixture, accepted its version-10 counterpart, and checked default/pinned inner-table topologies. An isolated SQL probe reproduced unsigned TTL wrap before the repair and rejected invalid bucketed TTLs afterward. Build and test logs were independently audited. The bucket-settings fixture covers malformed metadata replay, safe tags-only reads, guarded samples reads/inserts, boundary steps and source overrides. The declared-ID fixture fails before the repair, then checks both target kinds, `INSERT` side effects, deferred replay, high-ID preservation and legacy `ATTACH`. The prepatch probe stored ID 4294967297 as 1 after a mismatched replacement; the declared-ID contract now rejects that replacement. A separate legacy all-external regression fails before the bound-header repair, then verifies rejection without writes for all four ID-bearing target kinds before and after short `ATTACH`. Same-type replacements preserve the high ID without recording an ID setting. This is static replacement coverage, not a full DDL-race proof. The tests used the merged working tree with disposable data; they are not exact-commit Linux CI or multi-replica coverage. Remaining gates: Linux exact-head CI, full Fast, sanitizers, mixed-version upgrade/downgrade, private persisted-data inventory/recovery, and performance. Preserve existing submodule checkouts and old data; do not deploy this merge to an existing data directory until the compatibility gate is resolved. Related: #121216 CI: https://s3.amazonaws.com/clickhouse-test-reports/PRs/121216/860921c4151ca79dafa3ff52627460aafacb195a/pr/result_fast_test.json
Merge master at e854e02 without manual conflict resolution. The staged tree matches the automatic merge tree. Preserve the existing unstaged five-file CI fixture patch and all initialized submodule checkout heads. Verification: Git merge-integrity checks only. Combined-base build, runtime, performance, and CI remain unrun.
Fast failed because the scalar targets in the `CREATE AS` fixture inherited the latest TimeSeries format. Pin both owners to version 9, since normalization deliberately removes the copied version setting. Replace direct server-metadata edits rejected by Style with SQL-visible validation and in-process replay tests. Keep the product guards unchanged. Cover invalid bucket steps, valid endpoint controls, external target drift, and TTL overflow before the selector's empty-range shortcut. Validation on the merged base: macOS arm64 Debug build of `clickhouse` and `unit_tests_dbms`; 60 unit tests and 10 selected stateless tests passed with zero selected skips. Guard-removal falsifiers failed before restoration. Linux CI, ARM Release, sanitizers and mixed-version tests remain unrun. Related: #121216 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=18dbb4824225fdf39dbe1fb70d89ba4e8846114e&name_0=PR
| { | ||
| samples = makeASTFunction("timeSeriesGroupArray", std::move(samples)); | ||
| group_by->children.push_back(make_intrusive<ASTIdentifier>(TimeSeriesColumnNames::ID)); | ||
| group_by->children.push_back(make_intrusive<ASTIdentifier>(TimeSeriesColumnNames::Bucket)); |
There was a problem hiding this comment.
[P1] Preserve row cardinality when samples is pruned
Grouping by (id, bucket) makes the bucketed read return multiple rows per series, but makeASTSelectFromTimeSeries still chooses a tags-only read whenever samples is absent. For an ordinary table with one series and samples at timestamps 100 and 4000, SELECT count() FROM ts FINAL therefore counts one row, while SELECT count(), sum(length(samples)) FROM ts FINAL counts two. This happens with normal inserts and fully merged data; projecting out a column changes the relation's row count.
Please make the bucketed table preserve its row cardinality across projections, including tags-only reads and count, and add a regression comparing these two queries.
Merge master at 58a8c36 without rewriting branch history. Keep upstream scalar TimeSeries versions through 10 and allocate version 11 to the unpublished bucketed layout. Earlier private bucketed definitions are rejected rather than silently reinterpreted. Make `FINAL` row cardinality independent of projection, pin generated bucket partition keys to UTC, preserve ordered Float64 rate-reset arithmetic, and copy sparse identifiers through the typed column helper. Restore legacy external-target ID validation before reads and writes. Preserve custom partition expressions during `CREATE AS`. Update affected schema fixtures and aggregate-documentation routing at the generator source. Add focused regressions, including red-before coverage for custom partition-key loss. Validation: Darwin arm64 Debug build; 218 selected PromQL/normalizer units; 23 selected stateless tests; aggregate documentation routing test. All passed. Current Linux CI, sanitizer, restart integration, and mixed-version tests remain pending. No codec byte-format change is included in this merge. Related: #121216 CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=d21890bb26a6c5c40db75aba1bedb6ddf60c4dc4&name_0=PR
The merge preserves upstream scalar versions through 10 and assigns bucketed storage version 11. Three fixtures still assumed the previous bucket defaults. Restore the scalar external version-9 target, use internal version-11 targets for DDL races, and count logical samples rather than bucket rows in the timezone test. Keep all four race failpoints and their rejection assertions intact. Verification: isolated Darwin arm64 Debug probes passed the four original race functions, external version-9 DDL/write/read, and 40-sample plus fractional-time checks under two session timezones. The existing 218 unit and 23 stateless tests remain applicable; no C++ changed in this follow-up. Docker/Linux protocol and timezone-restart integration remain unrun. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121216&sha=d21890bb26a6c5c40db75aba1bedb6ddf60c4dc4&name_0=PR Related: #121216
Restore scalar external v8 and v10 codec expectations; cover bucketed v11 explicitly and update UTC engine expectations. Move physical inner-target read/write/restore checks into the UUID-aware fixture, retaining the same session for Memory backups. Remove manually generated `sumPromQL` docs and its navigation entry; keep C++ documentation as the generation source. No product C++ behavior changed. Validation: nine selected stateless cases passed on local macOS arm64 Debug; docs guard, shell syntax and diff checks passed. Exact-head Linux CI, ARM Release and sanitizer gates remain pending. CI report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/121216/4f3098595ecc5114cbe209c4deba65804fe492b8/pr/result_pr.json Related: #121216
| { | ||
| if (hasBucketedSamples(new_settings) && !hasBucketedSamples(old_settings)) | ||
| { | ||
| remove_column(TimeSeriesColumnNames::Timestamp); |
There was a problem hiding this comment.
[P2] Adapt copied expressions before removing scalar columns
Removing timestamp here leaves inherited retention and partition expressions referencing a column that the new samples target no longer has. For example:
CREATE TABLE src ENGINE = TimeSeries
SETTINGS version = 10, recent_samples_ttl_seconds = 0
SAMPLES INNER ENGINE = MergeTree
TTL toDateTime(timestamp) + INTERVAL 30 DAY;
CREATE TABLE dst AS src;The second statement now selects version 11, but applyASClause copies the old TTL unchanged and normalizeInnerEngine preserves it for the main samples target. Creating the target therefore fails when the TTL resolves timestamp. Custom partition expressions and an inherited recent_samples_partition_by referencing timestamp have the same problem. Please handle these expressions during the layout transition without silently discarding retention, and add a stateless regression for copying an older table with a TTL.
| description_promql, syntax_promql, arguments_promql, {}, returned_value_promql, | ||
| examples_promql, introduced_in_promql, FunctionDocumentation::Category::AggregateFunction}; | ||
|
|
||
| factory.registerFunction("sumPromQL", {createAggregateFunctionSumPromQL, documentation_promql}); |
There was a problem hiding this comment.
[P2] Add a discovery stub for the new public aggregate
The FunctionDocumentation registration does not publish this aggregate's reference page by itself. aggregate_generators in ci/jobs/scripts/docs/autogenerate/autogenerate_docs.py discovers only existing .mdx pages with autogenerated markers, and the current tree has no sumPromQL page or navigation entry. Calling discovery confirms that sum and sumKahan are included while sumPromQL is absent.
Please add docs/reference/functions/aggregate-functions/sumPromQL.mdx with the required frontmatter and empty AUTOGENERATED_START / AUTOGENERATED_END markers, and add its route to docs/reference/navigation.json. Keep the documentation body in this source registration; the dedicated generation workflow can populate the empty region.
This change combines and updates the bucketed
TimeSeriessamples work from#117344 with an opt-in hybrid
PromQL execution path. The storage dependency is included because the native
range processors consume ordered arrays of samples from the bucketed physical
layout; the current row-per-sample layout cannot provide that contract.
The native compiler recognizes only complete, explicitly supported query-tree
fragments. It emits custom
QueryPlansteps for bounded range-rate,sum by, rank, and the exact two-rate arithmetic shape used by ClockBench D06.Unsupported or unprofitable fragments continue through the existing PromQL-to-
SQL path. Admission happens before execution; an admitted native failure is
returned to the caller and is never replayed through SQL.
Resource safety is enforced with query-scoped limits for series, raw samples,
output groups, vector-grid cells, parallel lanes, and generated-plan block
sizes. The implementation preserves the normal query context, cancellation,
memory tracking, tags collector, SQL parents, and result finalization.
The bucketed storage schema is ported after the current
TimeSeriesversion 5.Existing versions keep their row-per-sample layout and current read/write and
PromQL behavior; new tables use the versioned bucket layout. The raw nested-
samples native path is admitted only when that physical contract is present.
Same-host ClockBench XL results on the recorded PoC build and dataset:
55.47 GiB tracked memory (-65.59%), 20.16 versus 62.73 GiB peak RSS
(-67.86%), and no spill versus 34 SQL spill parts.
51,635,200-value fingerprint with 3.75 GB tracked memory and 5.90 GiB peak
RSS, no spill, and 35.48 s mean server time. Compared with the original SQL
route, the preceding native-rate hybrid removed 66 spill files and reduced
tracked memory from 56.75 to 18.61 GiB; later fusion reduced memory further.
observed enabled-versus-forced-SQL deltas were -1.00% and +1.68%, within the
SQL-control spread.
These are workload-specific measurements, not a whole-ClockBench geomean or a
claim about every PromQL query. The native settings remain opt-in while wider
coverage, mixed concurrency, cancellation under XL load, and longer p95/p99
runs are still being evaluated.
Local verification on the fixed merged-master base
e3b91968f4ea:clickhouseandunit_tests_dbmsbuild: passed.passed.
sum by (rate(...))roots now share the same rate-series andcumulative per-series sample admission as native fragments; a regression
test covers samples split across input chunks.
group limit; a regression test covers multiple vector-matching keys producing
one valid output group.
TimeSeriestests: passed.contract findings and adding their regression coverage.
The cluster-configured late-samples read test was not reproduced in the local
single-node harness and remains a CI gate.
Related: #117344
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Adds an opt-in bounded native execution path for selected PromQL range-query fragments over the new bucketed
TimeSeriessamples layout, while unsupported query parts continue through the existing SQL execution path.Workflow [PR]
Sync PR [sync-upstream/pr/121216]