This is an automated email from the ASF dual-hosted git repository. zhangstar333 pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 9cc51da52e3 [cherry-pick](branch-30)fix date_floor function return wrong result (#41948) (#43588) 9cc51da52e3 is described below commit 9cc51da52e36710072e4e9530d7dff8d1e1304cd Author: zhangstar333 <87313068+zhangstar...@users.noreply.github.com> AuthorDate: Mon Nov 11 23:10:09 2024 +0800 [cherry-pick](branch-30)fix date_floor function return wrong result (#41948) (#43588) cherry-pick from master (#41948) --- be/src/vec/functions/function_datetime_floor_ceil.cpp | 7 ++++--- regression-test/data/correctness_p0/test_time_round.out | 5 +++++ regression-test/suites/correctness_p0/test_time_round.groovy | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/be/src/vec/functions/function_datetime_floor_ceil.cpp b/be/src/vec/functions/function_datetime_floor_ceil.cpp index 4801c4aa53b..bf74deaed1d 100644 --- a/be/src/vec/functions/function_datetime_floor_ceil.cpp +++ b/be/src/vec/functions/function_datetime_floor_ceil.cpp @@ -21,6 +21,7 @@ #include <boost/iterator/iterator_facade.hpp> #include <cstddef> #include <cstdint> +#include <cstring> #include <memory> #include <type_traits> #include <utility> @@ -293,7 +294,7 @@ struct FloorCeilImpl { PaddedPODArray<NativeType>& res, NullMap& null_map) { // time_round(datetime,const(period)) if (period < 1) { - null_map.resize_fill(dates.size(), true); + memset(null_map.data(), 1, sizeof(UInt8) * dates.size()); return; } for (int i = 0; i < dates.size(); ++i) { @@ -337,7 +338,7 @@ struct FloorCeilImpl { NativeType origin_date, PaddedPODArray<NativeType>& res, NullMap& null_map) { if (period < 1) { - null_map.resize_fill(dates.size(), true); + memset(null_map.data(), 1, sizeof(UInt8) * dates.size()); return; } switch (period) { @@ -424,7 +425,7 @@ struct FloorCeilImpl { const PaddedPODArray<NativeType>& origin_dates, PaddedPODArray<NativeType>& res, NullMap& null_map) { if (period < 1) { - null_map.resize_fill(dates.size(), true); + memset(null_map.data(), 1, sizeof(UInt8) * dates.size()); return; } for (int i = 0; i < dates.size(); ++i) { diff --git a/regression-test/data/correctness_p0/test_time_round.out b/regression-test/data/correctness_p0/test_time_round.out index face63a18a9..41e268482ed 100644 --- a/regression-test/data/correctness_p0/test_time_round.out +++ b/regression-test/data/correctness_p0/test_time_round.out @@ -123,3 +123,8 @@ 2020-02-02T11:45:14 2020-02-02T11:45:14 +-- !select_1 -- +2020-02-02T13:09:20 \N +2020-02-02T13:09:20 \N +2020-02-02T13:09:20 \N + diff --git a/regression-test/suites/correctness_p0/test_time_round.groovy b/regression-test/suites/correctness_p0/test_time_round.groovy index c042e0dd935..4ab6a6f6473 100644 --- a/regression-test/suites/correctness_p0/test_time_round.groovy +++ b/regression-test/suites/correctness_p0/test_time_round.groovy @@ -89,4 +89,5 @@ suite("test_time_round") { qt_select "select hour_floor(dt,2,o) from dbround order by id;" qt_select "select hour_floor(dt,p,'1919-08-10 11:45:14') from dbround order by id;" qt_select "select hour_floor(dt,2,'1919-08-10 11:45:14') from dbround order by id;" + qt_select_1 "select dt,hour_floor(dt,0) from dbround order by id;" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org