Repository navigation
Do not stash scale-divergent columns in the function property stress test - #110070
Conversation
…test The FunctionsStress property test (gtest_functions_stress.cpp) validates every function result with columnMatchesType before stashing it in additional_random_values for reuse as a later function's argument. That check compared only getDataType(), which for Decimal/DateTime64/Time64 reports the physical TypeIndex (Decimal64 for every scale). A function whose result column carried a scale different from its declared type therefore passed, got stashed, and was reused as an argument to an innocent consumer such as arrayPushBack, surfacing as a misattributed 'writeSlice expects same column types' LOGICAL_ERROR (issue ClickHouse#108517). Re-add the scale-aware detection to columnMatchesType behind an opt-in strict_decimal_scale argument (default off, so the engine callers in resolveFunction, ColumnFunction, ExpressionActions, ActionsDAG are unchanged), and use it in the stress test to detect a scale-divergent result. Such a result is attributed to the producing function via a new soft, default-ignored problem (scale_divergent_result) and is never stashed. Skipping the stash is the complete cut of the propagation path: generated random arguments are always scale-consistent (built via type->createColumn()), so the stash was the only way a divergent column could enter as an argument. Unlike the reverted ClickHouse#108551, the strict check is not a hard throw inside the test, so it cannot redden the whole run when a new scale-divergent producer appears; it just reports and skips it. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-0:20260710-230500 |
|
cc @alexey-milovidov @rschu1ze could you review this? It is the proper fix for the chronic writeSlice LOGICAL_ERROR in FunctionsStress (issue #108517), after the revert of #108551. Instead of a hard scale-strict throw (which reddened the whole test on every unfixed producer), the test now detects a scale-divergent function result, reports it as a soft default-ignored problem, and skips stashing it in additional_random_values, cutting the only path by which such a column becomes another function's argument. columnMatchesType stays scale-blind by default so the engine callers are unchanged. |
|
Workflow [PR], commit [a921779] Summary: ✅
AI ReviewSummaryThis PR hardens the Final VerdictStatus: ✅ Approve |
…s test Move the strict scale-divergence detection from the final merged result into checkAndFixupColumn on the stress-test path, so it runs on the bulk result and on every per-row result before insertRangeFrom merges it. A per-row divergence (row0 DateTime64(3), row1 DateTime64(7)) is a raw memcpy in ColumnDecimal, so the merged column can end up matching the declared scale and previously slipped the final-column-only check and got stashed. Now caught before the merge. Still a soft, default-ignored problem (scale_divergent_result); no throw. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (follow-up: per-row scale detection)Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260711-033300 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 63/103 (61.17%) · Uncovered code |
CI finish ledger — a921779Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
No test failures on this head. Session id: cron:our-pr-ci-monitor:20260711-080000 |
…ionsstress-scale-divergent-stash Do not stash scale-divergent columns in the function property stress test
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Fixes the chronic
Function writeSlice expects same column types for GenericValueSlice and GenericArraySinkLOGICAL_ERRORthat the function property stress test (FunctionsStress.stressingtest_functions_stress.cpp) keeps surfacing (issue #108517; seen most recently on #96130'sUnit tests (msan, function_prop_fuzzer)at report https://s3.amazonaws.com/clickhouse-test-reports/PRs/96130/840dde3c3a33b9412f7837fde92cd5c815aef79a/unit_tests_msan_function_prop_fuzzer/unit_tests_msan_function_prop_fuzzer.log , offending querySELECT arrayPushBack(a, CAST('1900-01-01 00:00:00.0' AS DateTime64(1))) FROM system.one ARRAY JOIN CAST([...] AS Array(Array(LowCardinality(Nullable(Date)))))).The error is correct and unreachable from real SQL (the analyzer unifies operands to the least supertype before execution, verified: the exact query above returns results with no error). It is a stress-test artifact. The test validates every function result with
columnMatchesTypebefore stashing it inadditional_random_valuesfor reuse as another function's argument. That check compared onlygetDataType(), which for Decimal/DateTime64/Time64 reports the physicalTypeIndex(Decimal64for every scale). A function whose result column carried a scale different from its declared type passed, got stashed, and was reused as an argument to an innocent consumer such asarrayPushBack, where the declared-type cast is skipped and the scale-divergent physical column flows straight into GatherUtils, trippingwriteSlice.This re-lands the scale-aware detection removed in #108981 (revert of #108551), but not as a hard throw inside the test:
columnMatchesTypegains an opt-instrict_decimal_scaleargument (default off, so the engine callers inresolveFunction,ColumnFunction,ExpressionActions,ActionsDAGkeep the scale-blind behaviour they rely on).scale_divergent_result), and never stashes it.Skipping the stash is the complete cut of the propagation path: generated random arguments are always scale-consistent (built via
type->createColumn()), so the stash was the only way a divergent column could become an argument. Because the strict check is only a soft, ignored report (not a throw), a newly appearing scale-divergent producer is recorded but cannot redden the whole run, which is exactly the failure mode that caused #108551 to be reverted. The known producers found while #108551 was live (changeDate/timeSlotsin #108994,reinterpretin #108878) are already fixed on master; this change makes the harness robust to any remaining or future ones.Regression coverage:
gtest_validate_column_typeasserts that a scale-7 column labelledDateTime64(3)is accepted by the default check and rejected by the strict check, both at top level and nested insideArray(DateTime64(3))(the exact #108517 shape).Version info
26.7.1.816(included in26.7and later)