Skip to content

Add RD variant and variant selection to the ALP codec - #99654

Merged
rienath merged 30 commits into
ClickHouse:masterfrom
nazarii-piontko:feature/alp-rd
Jul 3, 2026
Merged

rienath merged 30 commits into
ClickHouse:masterfrom
nazarii-piontko:feature/alp-rd

Conversation

@nazarii-piontko

@nazarii-piontko nazarii-piontko commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Experimental Feature

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

Add a Real Doubles (RD) variant and an optional ALP(AUTO|STD|RD) argument to the experimental ALP codec. Bare ALP now auto-selects between the existing STD scheme and RD instead of always using STD.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Add ALP RD variant for ALP floating-point compression codec.

The implementation introduces an additional parameter to the ALP codec: STD (standard ALP) or RD (real doubles ALP). If no parameter is specified, STD is used by default. The parameterized approach was chosen for two reasons. First, both variants belong to the same codec family. Second, it allows for future extension to automatic variant selection, similar to the reference implementation (e.g. having AUTO variant).

Resolves #99139

Version info

  • Merged into: 26.7.1.494 (included in 26.7 and later)

@nazarii-piontko nazarii-piontko changed the title Add ALP RD Codec Add ALP RD Codec Variant Mar 16, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Mar 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9cc957d]

Summary: ✅


AI Review

Summary

This PR adds the RD variant of the experimental ALP codec, exposes ALP(STD), ALP(RD), and ALP(AUTO), updates malformed-input coverage for the new wire format, and documents the new syntax. The codec logic and the previously open malformed-input issues look substantially improved at the current head, but there is still one compatibility regression in the default ALP path that I do not think is safe to merge as-is.

Findings
❌ Blockers
  • [dismissed by author -- https://github.com/Add RD variant and variant selection to the ALP codec #99654#discussion_r3196649150] src/Compression/CompressionCodecALP.cpp:1399-1423 changes bare CODEC(ALP) from the legacy STD-only format to adaptive STD-or-RD output. Existing tables already using ALP can therefore start producing RD blocks immediately after upgrade, while older replicas in a rolling upgrade still only know the old STD layout and will fail when they fetch those parts. The codec being experimental does not remove the mixed-version read path: allow_experimental_codecs gates creating the table, not decoding already-replicated parts. Suggested fix: keep bare ALP on the legacy STD encoding path and require explicit opt-in via ALP(AUTO) / ALP(RD), or gate the new default behind a compatibility setting.
Final Verdict

Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-experimental Experimental Feature label Mar 16, 2026
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
@rienath rienath self-assigned this Mar 17, 2026
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
@nazarii-piontko
nazarii-piontko marked this pull request as ready for review March 21, 2026 18:36
@nazarii-piontko

Copy link
Copy Markdown
Contributor Author

There is an issue with adding performance tests because the way codecs_float_select and codecs_float_insert are currently written produces malformed SQL for ALP(RD). I would need advice on where to change the performance file, whether to add an alias to ALP(RD), or if the approach of passing a parameter to ALP is incorrect.

@rienath rienath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nazarii-piontko! Thanks for the follow-up and for your patience. I've started with a few high-level comments. Once we're aligned on those, I'll do a more detailed pass on the implementation itself

Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
…d block header encoding and documentation updates
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
@rienath rienath changed the title Add ALP RD Codec Variant Add RD variant and variant selection to the ALP codec Jun 30, 2026
Comment thread src/Compression/CompressionCodecALP.cpp Resolved

@rienath rienath left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully the last one before we can merge. I commented out the perf test and will re-enable it in follow-up PR s.t. we can merge this one with green CI

Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
Comment thread src/Compression/CompressionCodecALP.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.50% 85.50% +0.00%
Functions 92.70% 92.70% +0.00%
Branches 77.70% 77.60% -0.10%

Changed lines: Changed C/C++ lines covered: 571/603 (94.69%) · Uncovered code

Full report · Diff report

@rienath rienath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've said this multiple times, but I'll say it again: this is a great PR, thank you for working on it (and the original ALP)! Very impactful feature

@rienath
rienath added this pull request to the merge queue Jul 3, 2026
Merged via the queue into ClickHouse:master with commit 6d8a875 Jul 3, 2026
174 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 3, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Add RD variant and variant selection to the ALP codec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors 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.

Add ALP_RD compression support

4 participants