Repository navigation
Revert "Fix function property stress test scale-blind validity gate and changeDate result scale" - #108981
Conversation
…nd changeDate result scale"
|
Workflow [PR], commit [9bbbb45] AI ReviewSummaryThis PR reverts #108551 to remove the strict decimal-scale validation that broke Findings❌ Blockers
Tests
Final VerdictStatus: ❌ Block Minimum required actions: keep the |
| /// structurally inconsistent with its type (a scale-3 column labelled DateTime64(8)). | ||
| const auto scale = typeid_cast<const DataTypeDateTime64 &>(*result_type).getScale(); | ||
| auto scale = DataTypeDateTime64::default_scale; | ||
| if constexpr (std::is_same_v<InputDataType, DateTime64>) |
There was a problem hiding this comment.
InputDataType here is DataTypeDateTime64, not the underlying DateTime64 field type, so this condition is always false for the change* functions over DateTime64(N). The result column is created with default_scale 3 while the values below are computed using result_type's scale N, leaving a column whose physical scale disagrees with its declared DateTime64(N) type. That still reaches structure-sensitive consumers such as arrayPushBack or arrayConcat as a LOGICAL_ERROR. Please keep the producer fix from #108551 when reverting the strict fuzzer gate, for example by creating the column from result_type's scale whenever ResultDataType is DataTypeDateTime64.
| *assert_cast<const DataTypeArray &>(*result_type).getNestedType()).getScale(); | ||
|
|
||
| auto res = ColumnArray::create(DataTypeDateTime64(result_scale).createColumn()); | ||
| auto res = ColumnArray::create(DataTypeDateTime64(start_time_scale).createColumn()); |
There was a problem hiding this comment.
TimeSlotsImpl rescales values to max({dt_scale, duration_scale, time_slot_scale}), but after this revert the returned type ignores Size scale and the data column is created with only start_time_scale. For timeSlots(toDateTime64(..., 1), toDecimal64(1, 1), toDecimal64(0.5, 4)), values are produced in scale 4 units but exposed as Array(DateTime64(1)), so timestamps are wrong and the result violates the documented "highest scale among all given arguments" contract. Please keep the timeSlots scale fix: include the third argument when deriving result scale and build the nested column with the declared DateTime64 scale from result_type.
|
@groeneai, now fix it properly. |
|
@alexey-milovidov, plan and status. Root cause of the revert: the strict Investigation results:
What I am opening now (fresh PR, off current master): re-land only the two proven producer source fixes plus a functional regression, no strict gate, so it cannot redden the stress test:
On the gate itself: it found two real bugs, so it has value, but as a hard throw it will keep reddening master whenever a new or missed producer mis-scales. If you want to keep it, I think it should record/normalize the divergent result instead of throwing, so the stress test stays a crash finder without gating master on producer-completeness. Your call; I can do that as a follow-up once #108878 and the producer fixes land. The production |
Bring the branch up to date with master to refresh CI. Master now includes the revert of ClickHouse#108551 (via ClickHouse#108981), which removed the scale-aware validity gate in the function property stress test that was surfacing a pre-existing reinterpret scale mismatch (Const(Decimal256) vs Decimal(76, 58)) and failing Unit tests (asan_ubsan, function_prop_fuzzer) on every PR. Master has not touched parseTimeDelta.cpp, formatReadableTimeDelta.cpp, or the two stateless tests, so the net change over master remains exactly the four files of this PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
changeYear/Month/Day/Hour/Minute/Second over DateTime64(N) built the result column at the hardcoded default scale 3 instead of N, because the `is_same_v<InputDataType, DateTime64>` guard was always false (InputDataType is a DataType class, DateTime64 a value-type alias). Read the scale from result_type instead. timeSlots over DateTime64 declared Array(DateTime64(max(start, duration))) and built the values column at start scale, ignoring the optional Size argument scale that the value rescaling uses (max(start, duration, size)). Include the Size scale in the declared return type and build the column at the declared scale. Both produced a column whose physical scale diverged from its declared type; feeding it into a structure-sensitive consumer (arrayPush/arrayConcat over Array(DateTime64(N))) skipped the cast on declared-type equality and reached the generic writeSlice, whose ColumnDecimal::structureEquals raised a LOGICAL_ERROR. These are the two producer fixes from ClickHouse#108551 (reverted by ClickHouse#108981 for an unrelated reason: its strict columnMatchesType stress-test gate reddened FunctionsStress.stress). This change re-lands only the producer fixes without the gate. Related: ClickHouse#108517 Related: ClickHouse#108981
…oeneai/fix-108517-writeslice-datetime64-array-push Revert "Fix function property stress test scale-blind validity gate and changeDate result scale"
Bring the branch up to date with master to refresh CI. Master now includes the revert of ClickHouse#108551 (via ClickHouse#108981), which removed the scale-aware validity gate in the function property stress test that was surfacing a pre-existing reinterpret scale mismatch (Const(Decimal256) vs Decimal(76, 58)) and failing Unit tests (asan_ubsan, function_prop_fuzzer) on every PR. Master has not touched parseTimeDelta.cpp, formatReadableTimeDelta.cpp, or the two stateless tests, so the net change over master remains exactly the four files of this PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
changeYear/Month/Day/Hour/Minute/Second over DateTime64(N) built the result column at the hardcoded default scale 3 instead of N, because the `is_same_v<InputDataType, DateTime64>` guard was always false (InputDataType is a DataType class, DateTime64 a value-type alias). Read the scale from result_type instead. timeSlots over DateTime64 declared Array(DateTime64(max(start, duration))) and built the values column at start scale, ignoring the optional Size argument scale that the value rescaling uses (max(start, duration, size)). Include the Size scale in the declared return type and build the column at the declared scale. Both produced a column whose physical scale diverged from its declared type; feeding it into a structure-sensitive consumer (arrayPush/arrayConcat over Array(DateTime64(N))) skipped the cast on declared-type equality and reached the generic writeSlice, whose ColumnDecimal::structureEquals raised a LOGICAL_ERROR. These are the two producer fixes from ClickHouse#108551 (reverted by ClickHouse#108981 for an unrelated reason: its strict columnMatchesType stress-test gate reddened FunctionsStress.stress). This change re-lands only the producer fixes without the gate. Related: ClickHouse#108517 Related: ClickHouse#108981
Reverts #108551
Wrecked havoc to
FunctionsStress.stress. Example:All failures: https://play.clickhouse.com/play?user=play&run=1#V0lUSAogICAgOTAgQVMgaW50ZXJ2YWxfZGF5cwpTRUxFQ1QKICAgIHRvU3RhcnRPZkRheShjaGVja19zdGFydF90aW1lKSBBUyBkYXksCiAgICBjb3VudCgpIEFTIGZhaWx1cmVzLAogICAgZ3JvdXBVbmlxQXJyYXkocHVsbF9yZXF1ZXN0X251bWJlcikgQVMgcHJzLAogICAgYW55KHJlcG9ydF91cmwpIEFTIHJlcG9ydF91cmwKRlJPTSBjaGVja3MKV0hFUkUgKG5vdygpIC0gdG9JbnRlcnZhbERheShpbnRlcnZhbF9kYXlzKSkgPD0gY2hlY2tfc3RhcnRfdGltZQogICAgQU5EIHRlc3RfbmFtZSA9ICdGdW5jdGlvbnNTdHJlc3Muc3RyZXNzJwogICAgLS0gQU5EIGNoZWNrX25hbWUgPSAnVW5pdCB0ZXN0cyAodHNhbiwgZnVuY3Rpb25fcHJvcF9mdXp6ZXIpJwogICAgQU5EIHRlc3Rfc3RhdHVzIElOICgnRkFJTCcsICdFUlJPUicpCiAgICBBTkQgKHB1bGxfcmVxdWVzdF9udW1iZXIgPSAwIE9SIGJhc2VfcmVmIElOICgnbWFzdGVyJykpCiAgICBBTkQgdGVzdF9jb250ZXh0X3JhdyBMSUtFICclQ29kZTolJwpHUk9VUCBCWSBkYXkKT1JERVIgQlkgZGF5IERFU0MK
Version info
26.7.1.296(included in26.7and later)