Skip to content

TimeSeries: Rename the outer column time_series to samples - #119225

Merged
vitlibar merged 2 commits into
ClickHouse:masterfrom
vitlibar:timeseries-rename-samples-column
Sep 14, 2026
Merged

vitlibar merged 2 commits into
ClickHouse:masterfrom
vitlibar:timeseries-rename-samples-column

Conversation

@vitlibar

@vitlibar vitlibar commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Experimental Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Rename the outer column time_series to samples in TimeSeries table engine.

A sample is a pair of a timestamp and a value, so samples is an array of such pairs. It matches to how this term is used in Prometheus. Recently we called such an array time_series which was a bit confusing because a time series is normally a series of samples with its attached tags. So it feels right to rename this column.

Command INSERT INTO ts_new SELECT * FROM ts_old will still work (despite columns having different names) because the position of the column time_series/samples in SELECT * FROM ts is the same


Workflow [PR]
Sync PR [sync-upstream/pr/119225]

@vitlibar vitlibar added do not test disable testing on pull request comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... labels Sep 10, 2026
@vitlibar
vitlibar force-pushed the timeseries-rename-samples-column branch from f4945ed to c34c129 Compare September 10, 2026 21:02
@vitlibar vitlibar changed the title [WIP] TimeSeries: Rename the outer column time_series to samples TimeSeries: Rename the outer column time_series to samples Sep 10, 2026
@vitlibar
vitlibar marked this pull request as ready for review September 10, 2026 21:03
@vitlibar vitlibar removed the do not test disable testing on pull request label Sep 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4440ac1]

Summary: ✅


AI Review

Summary

This PR renames the outer TimeSeries samples column to samples for version 3 tables, threads the version-aware name through the SQL and PromQL surfaces, and adds compatibility coverage for older versions. The versioned call sites now look consistent overall, but one blocker from the earlier review is still present in the current head.

Findings

❌ Blockers

  • [src/Storages/TimeSeries/PrometheusRemoteReadProtocol.cpp:186-197] [dismissed by author -- https://github.com/TimeSeries: Rename the outer column time_series to samples #119225#discussion_r3986452454] convertBlockToProtobuf still reads tags_offsets[i - 1] and time_series_offsets[i - 1] on the first output row. For any non-empty remote-read response, i == 0 underflows both arrays before the loop has emitted a single series, so the first label/sample range is built from out-of-bounds data and this path remains UB. Suggested fix: use the same (i == 0) ? 0 : offsets[i - 1] guard already used in PrometheusHTTPProtocolAPI::writeQueryResponseRangeVectorBlock, and add a regression test that exercises a non-empty Prometheus remote-read response.
Final Verdict

❌ Changes requested.

LLVM Coverage Report

⚠️ No coverage measurement for commit 4440ac1: incomplete coverage measurement: 1 of 21 shard profiles are missing: LLVM_COVERAGE_FILE_it_8.profdata.

@clickhouse-gh clickhouse-gh Bot added the pr-experimental Experimental Feature label Sep 10, 2026
@nikitamikhaylov nikitamikhaylov self-assigned this Sep 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 4440ac1e6 with master 0d04f2bc2 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

69 translation units recompiled, 193 s compile time in total, 69 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.06 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +9.9 s (+5%) in total before that adjustment.

Job report

vitlibar added a commit to vitlibar/ClickHouse that referenced this pull request Sep 11, 2026
`04836_time_series_selector_whole_metric_pk_range` still inserted into `time_series` for `ts_prune`.
`05175_timeseries_samples_column_rename` placed the storage `SETTINGS` after the `TimeSeries` targets,
so they were parsed as query settings and `ATTACH TABLE` failed with `UNKNOWN_SETTING`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119225&sha=c34c1299c83d66a6618bec8557fc3002037c09e5&name_0=PR
PR: ClickHouse#119225
@vitlibar
vitlibar force-pushed the timeseries-rename-samples-column branch from 7b85aa2 to 2605205 Compare September 11, 2026 05:44
Comment thread src/Storages/StorageTimeSeries.cpp Resolved
@vitlibar
vitlibar force-pushed the timeseries-rename-samples-column branch from 2605205 to 07ee78e Compare September 11, 2026 05:59
@vitlibar
vitlibar force-pushed the timeseries-rename-samples-column branch from 07ee78e to fde7941 Compare September 11, 2026 09:34
@vitlibar

Copy link
Copy Markdown
Member Author

03100_lwu_deletes_4_index - waiting for #119400

The rename is TimeSeries version 3. Tables of earlier versions keep the column
`time_series`, and the table functions prometheusQuery and prometheusQueryRange
return the column under the name used by the table.
@vitlibar
vitlibar force-pushed the timeseries-rename-samples-column branch from fde7941 to e456937 Compare September 13, 2026 23:42
@vitlibar

Copy link
Copy Markdown
Member Author

@groeneai Investigate CI failures

@groeneai

Copy link
Copy Markdown
Collaborator

Investigated the current head e45693723dda. The only red checks are the five Performance Comparison (arm_release, master_head, N/6) shards, and all five come from this PR's own diff. Nothing else on this head fails.

Root cause

The rename reached the <fill_query> of five perf tests. The perf comparison runs the same test file against both servers, and the reference side is an unpatched build (26.9.1.1435, per the Tested Commits table) where the outer column is still time_series. So the fill query dies on the reference in do_create (tests/performance/scripts/perf.py:815):

clickhouse_driver.errors.ServerException: Code: 16.
DB::Exception: No such column samples in table default.promql_tags_transform.
...
4. DB::InterpreterInsertQuery::getSampleBlock(...)
5. DB::InterpreterInsertQuery::execute()

do_create re-raises for a setup query that has no opt-out, so this is fatal and the shard goes red. The mapping is exactly one modified file per failing shard:

Shard Test whose <fill_query> fails
1/6 promql_tags_transform
2/6 promql_selector_id_range_row_cost
3/6 promql_selector_pk_range
4/6 promql_topk
5/6 promql_set_operator_presence_mask

6/6 has none of those five files in its slice, and it is green.

One misleading detail: each failing shard reports 10 errors, but that is the ten captured traceback lines of a single failing test, not ten distinct failures. run-errors.tsv for 1/6 has ten rows, all promql_tags_transform.

Remedy

perf.py has an opt-out for this case: do_not_check_in_pr on a top-level <create_query>/<fill_query> tolerates that query failing on the reference server and runs the test on the new server only. It is keyed on --pr-number alone, which CI passes (ci/jobs/performance_tests.py:1251), so it matches here:

<fill_query do_not_check_in_pr="119225">

The preconditions hold for all five files: each has exactly one top-level <fill_query>, none uses shell queries (the attribute is rejected together with those), and in each file that INSERT column list is the only real time_series reference, the other grep hit being the setting name allow_experimental_time_series_table.

Two caveats. This stops the red but does not recover the comparison: those five tests then measure the new server only, and become comparable again after the rename is on master. And the attribute goes inert on merge, since master runs pass --pr-number 0 and the reference will have samples by then.

Everything else on this head

Stress test (arm_tsan) is a green job. Its three failing rows (Hung check failed, possible deadlock found, Possible deadlock on shutdown, and the signal-9 OOM) are the chronic trio I already track across many unrelated PRs and master, so they are not from this PR. 03100_lwu_deletes_4_index last failed on fde7941c8752 and is clean now that #119400 is merged. 05175_timeseries_samples_column_rename last failed on 07ee78e98abd and is clean on this head.

…rver

The fill queries insert into the outer column `samples`, which the master
server of the performance comparison doesn't have yet, so they are marked with
do_not_check_in_pr="119225". The attribute can be removed after the merge.
@clickhouse-gh

clickhouse-gh Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

PromQL Compliance Report

Baseline: S3 master 0d04f2bc2

Metric Baseline Current Δ
Score 84.23% 84.23% +0.00%
Passed 454 454 +0
Failed 3 3 +0
Unsupported 82 82 +0

Note: score is unchanged vs baseline.

Uploaded compliance JSON for this PR commit

@vitlibar
vitlibar added this pull request to the merge queue Sep 14, 2026
Merged via the queue into ClickHouse:master with commit 0013337 Sep 14, 2026
176 checks passed
@vitlibar
vitlibar deleted the timeseries-rename-samples-column branch September 14, 2026 14:03
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 14, 2026
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Sep 18, 2026
…ale-promql-perf-pr-marker

Perf tests: remove stale do_not_check_in_pr for ClickHouse#119225
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... pr-experimental Experimental Feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants