Repository navigation
Packed format for statistics - #93414
Conversation
|
Workflow [PR], commit [88fd122] Summary: ❌
|
595ee45 to
4e627a6
Compare
|
I recall a pain point for some data warehouses based on Parquet is that the Parquet statistics (per file, and per row-group) are compact, and require parsing in their entirety just to extract the statistics for a single column of interest. Does this packed format's design allow partial reads, that would mitigate such a bottleneck? |
|
Yes, a packed format will allow partial reads. P.S.: current format in this PR is a temporary placeholder and will be changed. |
06c0325 to
6970fcc
Compare
6970fcc to
8451337
Compare
This reverts commit f5783b7.
| { | ||
| auto block = getInputPort().getHeader().cloneWithColumns(chunk.getColumns()); | ||
| ProfileEventTimeIncrement<Microseconds> watch(ProfileEvents::MergeTreeDataWriterStatisticsCalculationMicroseconds); | ||
| statistics_to_build.buildIfExists(block); |
There was a problem hiding this comment.
Do I understand correctly that we always have statistic only for a single column and that is why this code works for Vertical Merge? Looks like semantically nothing prevents from calculating Uniq of pair of columns, by I guess we don't plan to have such feature.
|
|
||
| /// Helper class, which holds chain of buffers to write data file with marks. | ||
| /// It is used to write: one column, skip index or all columns (in compact format). | ||
| template<bool only_plain_file> |
There was a problem hiding this comment.
It meant "do not write file with marks" and was used only for statistics.
| return rename_vector; | ||
| } | ||
|
|
||
| static void processStatisticsChanges( |
There was a problem hiding this comment.
Sorry, I cannot validate this function.
| /// Buffer chain: plain_file <- plain_hashing <- compressor <- compressed_hashing | ||
| auto plain_file = data_part_storage.writeFile(filename, 4096, write_settings); | ||
| HashingWriteBuffer plain_hashing(*plain_file); | ||
| CompressedWriteBuffer compressor(plain_hashing, compression_codec, 1024 * 1024); |
There was a problem hiding this comment.
This guy already add checksum for each block. I don't understand why we store such files in checksums.txt.
There was a problem hiding this comment.
Yes, it may be redundant for the compressed files, but we use checksums as map with files to bypass access to filesystem in many places.
|
|
||
| readIntBinary(rows, buf); | ||
| std::vector<StatisticsType> stat_types; | ||
| for (size_t i = 0; i < static_cast<UInt8>(StatisticsType::Max); ++i) |
There was a problem hiding this comment.
overcomplicated serde, but okay
5fe22f3
…ed as paths, two readings of one input Blind reviews of the pull requests that introduced nine bugs fixed later (ported in ClickHouse#131294-ClickHouse#131302) showed these gaps: - Data the server wrote itself and reads back (parts, patch parts, packed-file indexes, `ssd_cache` files) was treated as trusted, so out-of-bounds reads on it were dismissed or rated as Nits (ClickHouse#126553, ClickHouse#116007, ClickHouse#86095). - No prompt for overflow of sizes computed from user-controlled counts (`ColumnString::replicate`, ClickHouse#61075). - No prompt for names read from data that become paths (packed archive index, ClickHouse#93414). - A security check that reads its input differently from the consumer (first vs last repeated key, Boolean spellings), which the real review of ClickHouse#106855 missed. Also ask for a separate pass over parsers and security decisions in large pull requests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Improved storage format of statistics. All statistics are now stored in a single file.
Version info
26.2.1.674