Repository navigation
Fix fasttest exception in file inferred Nullable cols - #102509
Conversation
|
Workflow [PR], commit [a78907b] Summary: ✅
AI ReviewSummaryThis PR fixes Final VerdictStatus: ✅ Approve |
… the regression test Address review: without forcing these settings, the test could fall back to a normal file read if the count fast path is disabled in a test profile, and would no longer exercise the `ColumnConst` subcolumn path. Co-Authored-By: Claude Fable 5 <[email protected]>
…egression test The test relies on the inferred schema wrapping columns in `Nullable` to exercise the `ColumnConst(Nullable(...))` subcolumn path. Pin `schema_inference_make_columns_nullable = 1` so a future change of the default cannot silently stop the test from covering the fixed code. Co-Authored-By: Claude Fable 5 <[email protected]>
|
CI triage for the latest run (06ec723):
Also addressed the review feedback by pinning |
The stateless test `04115_file_count_from_nullable_csv.sh` did not reliably exercise the `ColumnConst` unwrap branches in `IDataType::getSubcolumn` and `IDataType::tryGetSubcolumn` (the `COUNT(*) FROM file(...)` fast path can succeed without hitting them, so LLVM coverage left them uncovered). Add a focused gtest that builds a `ColumnConst(Nullable(String))` and calls both methods directly, verifying they return a `ColumnConst` of the original size for an existing subcolumn (`null`) and `nullptr` for a missing one. This keeps the fix guarded regardless of the end-to-end query being reproducible. Addresses review feedback on ClickHouse#102509
|
CI triage for run 71205354:
The branch has been updated with the latest |
|
CI triage for run 76bbeed6 — all four failures are pre-existing flakes, unrelated to this PR (which only touches
AI review is ✅ Approve, no unresolved review threads, and changed-lines coverage is 100%. Merged the latest |
|
CI triage for 84099b7: all three reds are unrelated to this PR.
Merged current master (clean, master did not touch this PR's files) to pull in the #111353 fix and re-run CI: b82ba54. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 33/33 (100.00%) · Uncovered code |
alexey-milovidov
left a comment
There was a problem hiding this comment.
Interesting, because we don't store ColumnConst anywhere, so this code path is irrelevant for now. But we plan to do it. There is "automatic Const and LowCardinality storage representations" in the roadmap. So the fix is marginally useful. I think it does not make it worse - let's merge.
…iners The aggregate-state carve-out in `checkColumnStructure` (functions with the same state representation compare equal, e.g. `quantileState` vs `quantilesState(0.9)`) applied only to top-level `ColumnAggregateFunction`. When an expression over a `UNION ALL` of such states wraps them into another column (e.g. `tuple(s)`), the nested columns fell into the strict `IColumn::getName` comparison, and debug and sanitizer builds failed the query plan and pipeline header checks with a logical error 'Block structure mismatch in after optimization liftUpUnion stream'. Make the comparison recursive: descend into plain container columns (Tuple, Array, Map, Nullable, Const, Sparse, Replicated) and apply the aggregate-state relaxation at any nesting depth; all other columns are still compared by full name, exactly as before. Found by AST fuzzer: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102509&sha=06ec723ed42b84c7c77f932d8afb808060adca5c&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29 (the failure was unrelated to ClickHouse#102509) Closes: ClickHouse#111185 Co-Authored-By: Claude Fable 5 <[email protected]>
The stateless test `04115_file_count_from_nullable_csv.sh` did not reliably exercise the `ColumnConst` unwrap branches in `IDataType::getSubcolumn` and `IDataType::tryGetSubcolumn` (the `COUNT(*) FROM file(...)` fast path can succeed without hitting them, so LLVM coverage left them uncovered). Add a focused gtest that builds a `ColumnConst(Nullable(String))` and calls both methods directly, verifying they return a `ColumnConst` of the original size for an existing subcolumn (`null`) and `nullptr` for a missing one. This keeps the fix guarded regardless of the end-to-end query being reproducible. Addresses review feedback on ClickHouse#102509
…-crash Fix fasttest exception in file inferred Nullable cols
Fix an exception in the
COUNT(*)fast path forfile(...)when the inferred schema wraps columns inNullable:IDataType::getSubcolumnandIDataType::tryGetSubcolumndid not handleColumnConst, so extracting a subcolumn from a constant column threw an exception. Now the constant is unwrapped, the subcolumn is extracted from the nested column, and the result is wrapped back intoColumnConst.Note: the original end-to-end failure (#102044) is no longer reproducible on current master because the triggering code path changed, but
IDataType::getSubcolumn/tryGetSubcolumnstill lack theColumnConsthandling (whileIDataType::getSerializationInfoalready has it), so this remains a valid robustness fix, and the regression test pins the relevant settings to keep exercising this path. Since the misbehavior is not reproducible on master, the changelog category is set to Improvement rather than Bug Fix.This fixes #102044
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Handle
ColumnConstinIDataType::getSubcolumnandIDataType::tryGetSubcolumn: the constant is unwrapped, the subcolumn is extracted from the nested column, and the result is wrapped back intoColumnConst. This prevents a potential exception in theCOUNT(*)fast path forfile(...)when the inferred schema wraps columns inNullable. Closes #102044.Documentation entry for user-facing changes