From 56fd38de448a45db4829668791346da3e20540c8 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 18 Sep 2022 10:38:10 +0200 Subject: [PATCH 1/2] Add a test for #38383 --- .../0_stateless/02427_column_nullable_ubsan.reference | 10 ++++++++++ .../0_stateless/02427_column_nullable_ubsan.sql | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/queries/0_stateless/02427_column_nullable_ubsan.reference create mode 100644 tests/queries/0_stateless/02427_column_nullable_ubsan.sql diff --git a/tests/queries/0_stateless/02427_column_nullable_ubsan.reference b/tests/queries/0_stateless/02427_column_nullable_ubsan.reference new file mode 100644 index 00000000000..e6c99ff9291 --- /dev/null +++ b/tests/queries/0_stateless/02427_column_nullable_ubsan.reference @@ -0,0 +1,10 @@ +0 999999 999999 +0 999998 999998 +0 999997 999997 +0 999996 999996 +0 999995 999995 +0 999994 999994 +0 999993 999993 +0 999992 999992 +0 999991 999991 +0 999990 999990 diff --git a/tests/queries/0_stateless/02427_column_nullable_ubsan.sql b/tests/queries/0_stateless/02427_column_nullable_ubsan.sql new file mode 100644 index 00000000000..3d1a51804a7 --- /dev/null +++ b/tests/queries/0_stateless/02427_column_nullable_ubsan.sql @@ -0,0 +1 @@ +SELECT * FROM (SELECT * FROM (SELECT 0 AS a, toNullable(number) AS b, toString(number) AS c FROM numbers(1000000.)) ORDER BY a DESC, b DESC, c ASC LIMIT 1500) LIMIT 10; From 5d9e125c71a309e74afa7287e6f4785db23f6228 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 19 Sep 2022 00:23:46 +0200 Subject: [PATCH 2/2] Fix clang-tidy --- .../AggregateFunctionCategoricalInformationValue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp b/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp index 99ffc87e076..89ffdfa6109 100644 --- a/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp +++ b/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp @@ -35,12 +35,12 @@ private: using Counter = UInt64; size_t category_count; - Counter & counter(AggregateDataPtr __restrict place, size_t i, bool what) const + static Counter & counter(AggregateDataPtr __restrict place, size_t i, bool what) { return reinterpret_cast(place)[i * 2 + (what ? 1 : 0)]; } - const Counter & counter(ConstAggregateDataPtr __restrict place, size_t i, bool what) const + static const Counter & counter(ConstAggregateDataPtr __restrict place, size_t i, bool what) { return reinterpret_cast(place)[i * 2 + (what ? 1 : 0)]; }