Merge pull request #73172 from ucasfl/fix-ubsan

Fix UBSAN in largestTriangleThreeBuckets
This commit is contained in:
Yarik Briukhovetskyi 2024-12-12 16:26:37 +00:00 committed by GitHub
commit 8716d68c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View File

@ -329,7 +329,7 @@ public:
return [](IColumn & column, Float64 value) return [](IColumn & column, Float64 value)
{ {
auto & col = assert_cast<ColumnDateTime64 &>(column); auto & col = assert_cast<ColumnDateTime64 &>(column);
col.getData().push_back(static_cast<UInt64>(value)); col.getData().push_back(static_cast<Int64>(value));
}; };
default: default:
return [](IColumn & column, Float64 value) return [](IColumn & column, Float64 value)

View File

@ -15,3 +15,4 @@
(9978,978) 9978 10 (9978,978) 9978 10
(9988,988) 9988 10 (9988,988) 9988 10
(9999,999) 9999 11 (9999,999) 9999 11
[(0,'1900-01-01 00:00:00.000')]

View File

@ -61,4 +61,6 @@ SELECT
point_x - neighbor(point_x, -1) AS point_x_diff_with_previous_row point_x - neighbor(point_x, -1) AS point_x_diff_with_previous_row
FROM largestTriangleTreeBucketsBucketSizeTest LIMIT 990, 10; FROM largestTriangleTreeBucketsBucketSizeTest LIMIT 990, 10;
SELECT largestTriangleThreeBuckets(1)(0, '1900-01-01 00:00:00'::DateTime64);
DROP TABLE largestTriangleTreeBucketsBucketSizeTest; DROP TABLE largestTriangleTreeBucketsBucketSizeTest;