Repository navigation
Report NOT_IMPLEMENTED instead of a logical error when a Buffer table cannot read a codec subcolumn from its unflushed rows - #127793
Conversation
…om its rows
Reading `vec.quantized` or `vec.product_quantization_codebook` of a
`Quantized('product', ...)` column from a `Buffer` table that still holds
unflushed rows threw `LOGICAL_ERROR "Column or subcolumn ... not found in
Buffer table"` (ClickHouse#118714, found by the AST fuzzer).
The `product` codes depend on the per-part trained codebook, so
`SerializationQuantizedVector::enumerateStreams` gives these substreams no
column and no lazy creator, and `tryGetColumnFromBlock` returns null for the
buffered block. `BufferSource::generate` read every null as a column lost from
the block. The column is in the block; its subcolumn just cannot be computed
from an in-memory value, which `IDataType::getSubcolumn` already reports as
NOT_IMPLEMENTED for Memory, StripeLog, EmbeddedRocksDB and Join.
Now a subcolumn whose storage column is in the buffered block but cannot be
extracted is refused with NOT_IMPLEMENTED; a column missing from the block is
still a LOGICAL_ERROR. Subcolumns the value can produce (`size0`, the codes of
data-independent methods such as `int8`) are still read from the buffer.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121674&sha=660cb5a2eea7efc974c72871133b9d62da7cff2c&name_0=PR&name_1=AST%20fuzzer%20%28arm_asan_ubsan%29
Found on PR: ClickHouse#121674
Closes ClickHouse#118714
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds): 2 fixed, 1 not-blocking, round 2 clean
Round 2 (own review + second model on the fixed head): no findings. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261025-213800 |
|
cc @azat @rschu1ze, could you review this and add the |
|
Workflow [PR], commit [4347bc3] Summary: ❌
AI ReviewSummaryPR #127793 replaces an inappropriate Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 13 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 4347bc3Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261026-020004 |
Review feedback on ClickHouse#127793 and ClickHouse#127795: refuse the Quantized codec in Buffer the same way as in Log and TinyLog, for every method rather than only `product`. Buffer: a `product` column read a subcolumn of buffered rows that the buffer cannot produce, so `SELECT vec.quantized` from a Buffer with unflushed rows aborted with LOGICAL_ERROR "Column or subcolumn 'vec.quantized' not found in Buffer table" (AST fuzzer, arm_asan_ubsan: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=121674&sha=660cb5a2ee&name_0=PR). A fresh Buffer definition (explicit columns, `AS <table>`, a structure inferred from the destination, full-definition ATTACH) is now refused with ILLEGAL_COLUMN, and so is `ALTER ... ADD/MODIFY COLUMN` with the codec. The ALTER check looks at the codec, because MODIFY COLUMN sets the codec without attaching its serialization. Log and TinyLog now refuse every method, not only `product`. The check in `StorageLog::write` is removed: it existed only for definitions stored by older servers, which are replayed without the CREATE check, and with every method refused it would also break inserts into `int8` Log tables that work today. The by-value capture in `LogSink::createStreamGetter` stays. Closes ClickHouse#118714 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #118714
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Reading the codes of a
Quantized('product', ...)column from aBuffertable that still holds unflushed rows threwLogical error: 'Column or subcolumn 'vec.quantized' not found in Buffer table'(an abort in debug and sanitizer builds). It was found byAST fuzzer (arm_asan_ubsan)(report) and reported in #118714:The
productcodes and codebook depend on a codebook trained per part, soSerializationQuantizedVectorgives them no in-memory value andtryGetColumnFromBlockreturns null on the buffered block.BufferSource::generatetreated any null as a column missing from the block. Now, when the storage column is in the block but the subcolumn cannot be computed from it, the read fails withNOT_IMPLEMENTED, the codeMemory,StripeLog,EmbeddedRocksDBandJoinalready return here. A column really missing from the block is still aLOGICAL_ERROR. Subcolumns the in-memory value can produce (size0, the codes of data-independent methods such asint8) are still read from the buffer, and after a flush the codes come from the destination.Not for changelog: the
Quantizedcodec is experimental (enable_quantized_codec).Validation: the new test aborts a base-build server and passes on the fix, 50/50 with random settings and 5/5 with parallel replicas. Dropping the new branch, refusing every subcolumn or every codec subcolumn, or returning default codes each fail it. The
*buffer*,02354_vector_search_*,05241_*,05321_*and01475_read_subcolumns_storagestests give identical results on both builds.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127793]