-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug](function)fix date_floor function return wrong result #41948
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
TeamCity be ut coverage result: |
run buildall |
TeamCity be ut coverage result: |
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
) ``` void resize_fill(size_t n, const T& value) { size_t old_size = this->size(); if (n > old_size) { this->reserve(n); std::fill(t_end(), t_end() + n - old_size, value); } this->c_end = this->c_start + this->byte_size(n); } ``` if n is not greater than old_size, it's will not fill the data with value. so it's not set the null_map flag to 1, it's can't return NULL ``` mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6; +---------------------+--------------------+ | k11 | hour_floor(k11, 0) | +---------------------+--------------------+ | 2015-03-13 12:36:38 | | +---------------------+--------------------+ 1 row in set (0.03 se ``` after fix: ``` mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6; +---------------------+--------------------+ | k11 | hour_floor(k11, 0) | +---------------------+--------------------+ | 2015-03-13 12:36:38 | NULL | +---------------------+--------------------+ 1 row in set (0.03 sec) ```
) ``` void resize_fill(size_t n, const T& value) { size_t old_size = this->size(); if (n > old_size) { this->reserve(n); std::fill(t_end(), t_end() + n - old_size, value); } this->c_end = this->c_start + this->byte_size(n); } ``` if n is not greater than old_size, it's will not fill the data with value. so it's not set the null_map flag to 1, it's can't return NULL ``` mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6; +---------------------+--------------------+ | k11 | hour_floor(k11, 0) | +---------------------+--------------------+ | 2015-03-13 12:36:38 | | +---------------------+--------------------+ 1 row in set (0.03 se ``` after fix: ``` mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6; +---------------------+--------------------+ | k11 | hour_floor(k11, 0) | +---------------------+--------------------+ | 2015-03-13 12:36:38 | NULL | +---------------------+--------------------+ 1 row in set (0.03 sec) ```
Proposed changes
if n is not greater than old_size,
it's will not fill the data with value.
so it's not set the null_map flag to 1, it's can't return NULL
after fix: