Repository navigation
Conversation
|
Workflow [PR], commit [7e6878c] Summary: ❌
|
|
This is an excellent set of features, thank you! Should I subscribe to this PR for updates, or will it be split into many smaller PRs later for merging? |
|
This PR will be split into smaller ones. The first one #87241 will be merged soon. You can subscribe to this PR for updates, because I'll post links to other PRs with separate features. |
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
4 similar comments
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
…om-statistics Resolve conflicts and adapt the "serialization infos from statistics" work to current master. Statistics: - Remove the standalone `StatisticDefaults` statistics type and fold the per-column default count into `StatisticsBasic` (new `DefaultsCount` feature-mask bit; `getNumDefaults`/`estimateDefaults`, tracked only for types that support sparse serialization). `ColumnStatistics::estimateDefaults` and `getEstimate` now read the default count from `Basic`. SerializationInfo: - Reconcile master's streaming `serialization.json` writer with the statistics-based design: `SerializationInfo` carries only the serialization kind, while row/default counts come from statistics. Reading stays Poco-based (`fromJSON`/`fromJSONWithStats`). - Add streaming `writeJSONWithStats` and the version-aware `writeSerializationInfosJSON`, so versions before `WITHOUT_DATA` still store the row/default counts (synthesized from the chosen kinds) and stay readable by servers that derive the kind from those counts. Wired into `MergedBlockOutputStream`, `MutateTask` and the serialization-hints path. - Fix `loadSerializationInfosFromString`: the `stats` result was initialized for the wrong version and dereferenced as an empty optional when reading a pre-`WITHOUT_DATA` part. MergeTree: - `serialization_info_version` default stays `without_data`, with a fallback to implicit statistics when none are available (so sparse serialization keeps working on insert). - `MergeTask`: choose the merged part's serialization by carrying over the serialization kinds of the source parts. - `MergedBlockOutputStream`: re-enable empty/expired column pruning for mutations and merges. - Projection parts derive serialization from implicit statistics. Part of ClickHouse#85145 Co-Authored-By: Claude Opus 4.8 <[email protected]>
`updateSerializationHintsForPart` used to aggregate per-row default counts via the removed `SerializationInfo::add`/`remove`. Carry over the serialization kind of the source parts instead: hint a column as sparse once an active part serializes it sparse. Sparse is always a safe representation and the on-disk serialization is re-decided from statistics at write time, so an over-eager hint only affects how external data is parsed on `INSERT ... SELECT FROM` a file-like source, never correctness. Removing a part cannot un-aggregate a kind, so it is a no-op; `resetSerializationHints` rebuilds the hints from the active parts. This resolves the last commented-out block left over from removing the data-accumulation API of `SerializationInfo`. Part of ClickHouse#85145 Co-Authored-By: Claude Opus 4.8 <[email protected]>
`writeSerializationInfosJSON` derived the per-column `num_defaults` written for serialization-info versions before `WITHOUT_DATA` from the chosen serialization kind (sparse => all rows are defaults, otherwise none), discarding the real default counts that `getImplicitStatisticsForSparseSerialization` had already computed over the written block. That encoding is lossy: a dense column's real defaults were recorded as 0, which corrupts the aggregate default ratio an older server computes during its next merge on a mixed-version cluster. Carry the implicit statistics that chose the serialization to part finalization through the (previously unused) `GatheredData::statistics_for_serializations` field, and add `getEstimatesForSerializationInfos` to select the counts to persist: the real counts from those statistics for `INSERT` and projection writes, and a kind-based encoding only for the paths that decide the serialization without counting defaults (merges and mutations carry the kind forward from the source parts; serialization hints carry no row data). `writeSerializationInfosJSON` now only writes the estimates it is given. Part of ClickHouse#85145 Co-Authored-By: Claude Opus 4.8 <[email protected]>
For serialization-info versions before `WITHOUT_DATA` (`basic`/`with_types`), `serialization.json` stores the per-column `num_rows`/`num_defaults`. After the serialization-from-statistics refactoring only the `INSERT` path recomputed those counts; merges, mutations and the serialization-hints query-plan path passed empty statistics to `writeSerializationInfosJSON`, which threw `LOGICAL_ERROR: Missed statistics for column ...` for any sparse-capable column. `serialization_info_version` is randomized across `basic`/`with_types` in CI, so this affected most merges and mutations, not only rolling upgrades. Recompute the counts by adding implicit `Basic` statistics for sparse-capable columns into the part statistics (only for columns that do not already have `Basic`), so they are built by the regular statistics machinery over the written data (handling row-reducing merges) and recorded in `GatheredData::implicit_serialization_statistics`. The implicit statistics are removed again (`getStatisticsToPersist`) before the statistics files are written, so they are not persisted as user statistics; the per-column counts for `serialization.json` are taken from them beforehand. In a vertical mutation the counts of columns that are not rewritten are carried over from the source part. `writeSerializationInfosJSON` now takes the per-column `Estimates`. Part of ClickHouse#85145 Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @CurtizJ, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Changelog category (leave one):
This PR is a draft for developing automatic
LowCardinalityserialization. It contains several tasks that will be extracted and merged in separate PRs, but it's more convenient for me to develop them in one branch.This PR includes:
defaultsthat stores a number of default values in a columnLowCardinalityas a serialization according to theuniqstatisticLowCardinality