Repository navigation
Validate the argument list of an optimization of mergeTreeAnalyzeIndexes - #118644
Conversation
`parseArgumentsForOptimizations` navigated two levels of raw AST children of its
`args_array` argument without validating its shape, so
- a subquery there raised `Logical error: Trying to get name of not a column:
ExpressionList`, which aborts a debug build and which the AST fuzzer generates,
and
- a bare literal escaped as `boost::container::out_of_range: vector::at out of
range` (`STD_EXCEPTION`).
The argument is now extracted the way `extractParts` extracts the neighbouring
`parts_array` - an array literal wrapped in a `_CAST` with the analyzer, a bare
`array(...)` call without it - and anything else is reported as
`BAD_ARGUMENTS`.
As `extractParts` does, each element is evaluated on its own. That also fixes
the argument list `buildAnalyzeIndexQuery` itself sends when the old interpreter
is used: evaluating `array('col', 'L2Distance', 3, [1.5, 2.5], 1, 0)` as a whole
coerces every element to `String`, and the reference vector then failed with
`Bad get: has String, requested Array`.
Closes: #117610
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [5c58e57] Summary: ✅
AI ReviewSummaryThis PR hardens Missing context / blind spots
Final Verdict✅ No remaining review findings at the current PR head. LLVM Coverage ReportMeasured on commit 5c58e57.
Changed lines: Changed C/C++ lines covered: 72/79 (91.14%) · Uncovered code |
|
🕵 The two reds on
This change validates the |
The happy path of `vector_search_index_analysis` was asserted only with the analyzer, while the change also fixes the argument list `buildAnalyzeIndexQuery` sends when the old interpreter is used: evaluating the array as a whole coerced every element to `String` there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Addressed: the accepted argument list is now asserted on the old interpreter as well, which is the shape |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes4 object files changed (+61.78 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 units7 translation units recompiled, 12 s compile time in total, 7 of them have a recent master baseline. |
…imization-args-117610
…ysis` explicitly `extractOptimizationArguments` only guaranteed that the argument list of the optimization is array-like; the six elements were still decoded with raw `Field::safeGet`, so a list with a wrong element type - `['v', 'L2Distance', 3, 1, 1, 0]`, `[1, 'L2Distance', 3, [1.0], 1, 0]` - escaped as an internal `BAD_GET` instead of the `BAD_ARGUMENTS` this change promises. Every slot is now checked by type and a mismatch is reported as `BAD_ARGUMENTS` that names the offending parameter and its position. The flags accept `true` / `false` (the shape `buildAnalyzeIndexQuery` sends) as well as `0` / `1`, the search vector accepts integer literals next to floats. A wrong number of parameters lists the expected ones. The test is renumbered to 05218 (05142 is taken on master) and covers a wrong type in each slot, in both the `array(...)` and the array-literal shape. Its old-interpreter section is dropped: `enable_analyzer = 0` is rejected since 26.9. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…index_analysis` `toInt64(3)` evaluates to an `Int64` field; it was accepted by the previous `safeGet<UInt64>` path, so keep accepting it after the `>= 0` check. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…imization-args-117610
…o `Array(Variant)`
After the merge of master, the analyzer folds `array('v', 'L2Distance', 3, ...)` into
`_CAST(array(...), 'Array(Variant(...))')`, so `extractOptimizationArguments` must look
through the `_CAST` into the `array` call; otherwise every argument list, including the
one `buildAnalyzeIndexQuery` sends, was rejected with `BAD_ARGUMENTS`.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Closes: #117610
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A malformed argument list of an optimization of the
mergeTreeAnalyzeIndexestable function is now reported asBAD_ARGUMENTSinstead of a logical error or a rawstd::exception.Description
parseArgumentsForOptimizationsnavigated two levels of raw AST children of itsargs_arrayargument without validating its shape, soLogical error: Trying to get name of not a column: ExpressionList(which aborts a debug build, and the AST fuzzer generates exactly this shape), andboost::container::out_of_range: vector::at out of range(STD_EXCEPTION).The argument is now extracted the same way
extractPartsextracts the neighbouringparts_array- accepting an array literal wrapped in a_CAST, or a barearray(...)call, which is what an argument list of mixed types (the shapebuildAnalyzeIndexQuerysends) stays as - and reportingBAD_ARGUMENTSfor anything else. Each element is evaluated on its own, so it keeps its own type.The six parameters of
vector_search_index_analysisare then checked explicitly, one by one: a wrong element type -['v', 'L2Distance', 3, 1, 1, 0],[1, 'L2Distance', 3, [1.0], 1, 0], a negative limit, a flag other thantrue/false/0/1- is reported asBAD_ARGUMENTSnaming the offending parameter and its position, instead of escaping as an internalBAD_GET. A wrong number of parameters lists the expected ones.Workflow [PR]
Sync PR [sync-upstream/pr/118644]
Version info
26.10.1.648-master(included in26.10and later)