Numeric `T64` codec argument returns `BAD_GET` instead of a codec parameter error

Open Beginner friendly
#135,159 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
clickhouse, cpp
Domain
databases

Research direction

Start with the argument validation in src/Compression/CompressionCodecT64.cpp around lines 863–866, where the issue identifies the unchecked string access. Find the codec tests covering invalid T64 parameters and add a case for a numeric argument. The change is done when that input returns an explicit codec parameter or syntax error instead of BAD_GET, and the relevant test passes.

Written by the indexing model from the issue text.

Description

comp-codecs
Describe what's wrong

CODEC(T64(1)) passes a numeric literal into a string-only codec variant parser and returns the internal BAD_GET error (Code: 170). Other invalid codec arguments return explicit validation errors.

Does it reproduce on the most recent release?

Yes. Reproduced on the official 26.11.3.10 image and on master 26.12.1.406 (4bb4fd70a64f5f47d831ac058dc1e66ef7566379).

How to reproduce
CREATE TABLE t64_bad (v Int64 CODEC(T64(1))) ENGINE = MergeTree ORDER BY tuple();

Observed on both official builds (version and system.build_options.VERSION_GITHASH shown first):

26.11.3.10    140ed3946895ad84e6c05da55e9a117752e1f631
Code: 170. DB::Exception: Received from localhost:9000. DB::Exception: Bad get: has UInt64, requested String. (BAD_GET)

26.12.1.406   4bb4fd70a64f5f47d831ac058dc1e66ef7566379
Code: 170. DB::Exception: Received from localhost:9000. DB::Exception: Bad get: has UInt64, requested String. (BAD_GET)

T64(9) returns the same error. Controls on both builds: T64('LZ4') returns Code: 433 (ILLEGAL_CODEC_PARAMETER) with Wrong modification for T64: LZ4.; T64('LZ4', 1) returns Code: 431 (ILLEGAL_SYNTAX_FOR_CODEC_TYPE) with T64 support zero or one parameter, given 2.; Delta(7) returns Code 433, NONE(1) Code 378, and GCD(None) Code 431.

Expected behavior

Reject a non-string T64 variant with ILLEGAL_CODEC_PARAMETER or ILLEGAL_SYNTAX_FOR_CODEC_TYPE, as other invalid codec arguments are rejected.

Relevant code

src/Compression/CompressionCodecT64.cpp:863-866 in both v26.11.3.10-stable and 4bb4fd70a64f checks that the argument is an ASTLiteral, then calls literal->value.safeGet<String>() without checking the literal's value type. That call throws BAD_GET for a numeric literal.

Dominant language
C++
Stars
51.1k
Forks
9.3k
Avg merge
14h 56m
Merged PRs (30d)
423

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ClickHouse/ClickHouse

All issues in ClickHouse/ClickHouse

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.