Repository navigation
Conversation
|
My expectation was it should make beter compression ratio for Decimals. They are multiplyed by powers of 10 and should have trailing zeroes in least-significant bits. I didn't test it much. But it seems there's a win using it without LZ4/ZSTD. And there's no win after LZ4/ZSTD. It's just a bit more stable than default T64 in combination with future LZ4. Also I found it useful for values multiplied by exp2(N). In this case T64('byte_mask') beats T64('byte') variant regardless of future compression. |
|
Workflow [PR], commit [76c0520] Summary: ❌
AI ReviewSummaryThis PR adds Findings❌ Blockers
Tests
Final VerdictNot ready. LLVM Coverage ReportMeasured on commit 76c0520.
Changed lines: Changed C/C++ lines covered: 137/240 (57.08%) · Uncovered code |
|
Should I do anything with flaky tests? Tests fails are not related to my changes. |
|
@copilot resolve the merge conflicts in this pull request |
Nothing changes. |
Conflict in `src/Compression/CompressionCodecT64.cpp`: master reworked compression around a precomputed `T64Layout` (used by the new `tryGetCompressedSize` / `CompressedSizeCalculator`), added decompression bounds checks and introduced the `COOKIE_SIZE` / `MATRIX_SIZE` / `HEADER_SIZE` constants, while this branch added the `bit_mask` and `byte_mask` variants. Resolution: - `computeT64Layout` gained a `with_mask` template parameter and a `header_size` field, so the layout describes both the min/max header (`HEADER_SIZE`) and the mask header (`4 * sizeof(T)`). The mask path computes `valuable_bits` via `findMasks` and `getMaskBitsNumber`. - `compressData` and `decompressData` keep master's layout-driven shape and constants, with the `pext` / `pdep` steps and the mask header read/write under `if constexpr (with_mask)`. - `calculateCompressedDataSize` now takes the variant, so `tryGetCompressedSize` is exact for the mask variants too. - Master's "compressed size too small for the header" check now uses `header_size`, so it also covers the mask header. - Restored the mask bit of the cookie in `doCompressData`, which the automatic merge had attached to master's new `tryGetCompressedSize`. - `min` / `max` in `decompressData` are now initialized, since the `num_bits == 0` path reads `min` through a runtime ternary shared with the mask path. - Updated the on-disk layout comment for the two extra cookie bits and the mask header, and dropped a duplicated include block. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Pj9RDkQHKvbZ9UkWNgBwiN
Fast test failed to build after the merge with master:
src/Compression/CompressionCodecT64.cpp:69:5: error: code will never be executed [-Werror,-Wunreachable-code]
src/Compression/CompressionCodecT64.cpp:102:25: error: code will never be executed [-Werror,-Wunreachable-code]
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=94499&sha=0d5b3700919aaae774bcdc411f473b0a5c7ee8f4&name_0=PR&name_1=Fast+test
Master changed the default x86 build target from `x86-64-v2` to
`x86-64-v3`, which defines `__BMI2__`. `bitCompress64` and `bitExpand64`
returned early from an `#ifdef __BMI2__` block and then fell through to
the portable implementation, so that implementation became unreachable.
Turned the three implementations into one `#if` / `#elif` / `#else`
chain, and moved the declarations they need inside the `#else`. With
`__BMI2__` defined, `log2Floor` and `bitwiseInclusiveRightParity64` are
then used by nobody, so they are compiled only when the portable path is.
Checked that the file compiles with `-Weverything -Werror` at
`x86-64-v2`, `x86-64-v3` and `x86-64-v4`, and on `aarch64` both with and
without `sve2`. Also checked that `_pext_u64` / `_pdep_u64` and the
portable fallback agree on 3M random `(x, mask)` pairs, so the switch to
`x86-64-v3` does not change what the codec writes.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Pj9RDkQHKvbZ9UkWNgBwiN
`Build (arm_tidy)` fails with 11 `google-runtime-int` errors, all in
`src/Compression/CompressionCodecT64.cpp`:
error: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int,-warnings-as-errors]
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=94499&sha=f9ca9c7a6364d64cf08f2ec2d6120241142926b6&name_0=PR&name_1=Build+%28arm_tidy%29
`log2Floor`, `bitwiseInclusiveRightParity64`, `bitCompress64` and
`bitExpand64` were copied from the reference implementation, which spells
the type `unsigned long long`. Switched them to `UInt64`, which is what
the rest of the file uses, and dropped the local `using T` aliases that
only existed to shorten the name.
Checked with `clang-tidy` and the repository's `.clang-tidy`: 11 errors
before, none after. The file still compiles with `-Weverything -Werror`
at `x86-64-v2`, `x86-64-v3` and `x86-64-v4`, and on `aarch64` both with
and without `sve2`.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Pj9RDkQHKvbZ9UkWNgBwiN
| UInt8 cookie = static_cast<UInt8>(serializeTypeId(type_idx)) | static_cast<UInt8>(static_cast<UInt8>(variant) << 7); | ||
| UInt8 bit_flag = static_cast<UInt8>(static_cast<UInt8>(variant) << 7); | ||
| UInt8 mask_flag = static_cast<UInt8>((static_cast<UInt8>(variant) & 0x2) << 5); | ||
| UInt8 cookie = static_cast<UInt8>(serializeTypeId(type_idx)) | bit_flag | mask_flag; |
There was a problem hiding this comment.
The new mask variants change the T64 on-disk cookie layout without changing the outer 0x93 family byte. Older servers still interpret T64 cookies as variant = cookie >> 7 and type = cookie & 0x7f, so a block written as T64('byte_mask') for UInt64 is seen as type id 0x44 and rejected as bad T64 data. Because these spellings are accepted unconditionally, a mixed-version cluster or downgrade can start producing unreadable parts as soon as a table uses the new variant.
Please give the new encoding a disabled-by-default rollout mechanism, or version it under a new codec family byte instead of silently extending stable T64.
| variant = Variant::Byte; | ||
| else if (name == "bit") | ||
| variant = Variant::Bit; | ||
| else if (name == "byte_mask") |
There was a problem hiding this comment.
This is the user-visible entrypoint for the new spellings, but the PR still ships no focused coverage or measurements for them. The existing T64 tests only cover plain T64 and T64('bit'), so we never exercise round-trip correctness, mixed-sign data, or estimateCompressionRatio / tryGetCompressedSize on the new mask header.
For a persistent codec change, please add at least a stateless round-trip test for both byte_mask and bit_mask plus an estimateCompressionRatio case proving the predicted bytes match what is written. pr-performance was also skipped, so a small before/after measurement on the decimal / trailing-zero workloads from the PR description is still missing.
Did manually, pls check the code. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes5 object files changed (+71.93 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units39 translation units recompiled, 315 s compile time in total, 39 of them have a recent master baseline. Symbol sizes
|
|
Dear @nickitat, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Changelog category (leave one):
Changelog entry (a [user-readable short description]
add T64('byte_mask') and T64('bit_mask') codec variants
Documentation entry for user-facing changes
T64 crops most significant bits of value by min and max values in array. But it's possible to calculate always-ones and always-zeroes bitmasks to crop equal bits in any part of values. It could be done fast using PEXT/PDEP x86 instructions.
bit_compress()/bit_expand()operations that use such instructions are in proposal for C++ standard. Related part of PR was copy-pasted from this proposal and could be replaced when thebit_compress()/bit_expand()appear in stdlib.T64 itself is interested in context of "fast row-access and GPU-friendly compression" in context of Parquet replacement hype and Parquet answer It's possible to get a "row position" inside compressed data and decompress values in parallel using only a small "header".
Workflow [PR]
Sync PR [sync-upstream/pr/94499]