Hi, Alexander, On Jan 24, Alexander Barkov wrote:
Hello Sergei,
Thanks for the review. Please see a comment below:
On 1/24/24 03:34, Sergei Golubchik wrote:
Hi, Alexander,
On Jan 24, Alexander Barkov wrote:
revision-id: 1a3974f534f (mariadb-11.3.1-12-g1a3974f534f) parent(s): 83a79ba33b0 author: Alexander Barkov committer: Alexander Barkov timestamp: 2024-01-23 18:04:31 +0400 message:
MDEV-33299 Assertion `(tm->tv_usec % (int) log_10_int[6 - dec]) == 0' failed in void my_timestamp_to_binary(const timeval*, uchar*, uint)
diff --git a/sql/opt_rewrite_date_cmp.cc b/sql/opt_rewrite_date_cmp.cc index 5a6410414da..8ff0ab3847e 100644 --- a/sql/opt_rewrite_date_cmp.cc +++ b/sql/opt_rewrite_date_cmp.cc @@ -288,10 +288,13 @@ Item *Date_cmp_func_rewriter::create_end_bound() const_arg_ts.hour= 23; const_arg_ts.minute= TIME_MAX_MINUTE; const_arg_ts.second= TIME_MAX_SECOND; - const_arg_ts.second_part= TIME_MAX_SECOND_PART; + const_arg_ts.second_part= TIME_MAX_SECOND_PART - + my_time_fraction_remainder(TIME_MAX_SECOND_PART, + field_ref->decimals); if (check_datetime_range(&const_arg_ts)) return nullptr; res= new (thd->mem_root) Item_datetime(thd); + res->decimals= field_ref->decimals;
would it work you if always set res->decimals=6 here (and below)? looks like a simpler way to make the item consistent.
It should work. However, it's better to have equal fractional precision on the both sides, to go through the optimized execution path here:
thanks. would be good to have it in a comment. Like /* let's have the same number of decimals as the other argument to be able to use fast memcmp comparison method. */ Regards, Sergei Chief Architect, MariaDB Server and security@mariadb.org