Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions be/src/vec/functions/function_datetime_floor_ceil.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,7 @@
#include <boost/iterator/iterator_facade.hpp>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <type_traits>
#include <utility>
Expand DownExpand Up@@ -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) {
Expand DownExpand Up@@ -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) {
Expand DownExpand Up@@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions regression-test/data/correctness_p0/test_time_round.out
Original file line numberDiff line numberDiff line change
Expand Up@@ -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

Original file line numberDiff line numberDiff line change
Expand Up@@ -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;"
}