Alexander Barkov
c17a06abf8
MDEV-15310 Range optimizer does not work well for "WHERE temporal_column NOT IN (const_list)"
...
There were two problems related to the bug report:
1. Item_datetime::get_date() was not implemented.
So execution went through val_int() followed
by int-to-datetime or int-to-time conversion.
This was the reason why the optimizer did not
work well on data with fractional seconds.
2. Item_datetime::set() did not have a TIME specific code
to mix months and days to hours after unpack_time().
This is why the optimizer did not work well with negative
TIME values, as well as huge time values.
Changes:
1. Overriding Item_datetime::get_date(), to return ltime.
This fixes the problem N1.
2. Cleanup: Moving pack_time() and unpack_time() from
sql-common/my_time.c and include/my_time.h to
sql/sql_time.cc and sql/sql_time.h, as they are not needed
on the client side.
3. Adding a new "enum_mysql_timestamp_type ts_type" parameter
to unpack_time() and moving the TIME specific code to mix
months and days with hours inside unpack_time().
Adding a new "ts_type" parameter to Item_datetime::set(),
to pass it from the caller down to unpack_time().
So now the TIME specific code is automatically called
from Item_datetime::set(). This fixes the problem N2.
This change also helped to get rid of duplicate TIME specific code
from other three places, where mixing month/days to hours
was done immediately after unpack_time().
Moving the DATE specific code to zero hhmmssff
from Item_func_min_max::get_date_native to inside unpack_time(),
for symmetry.
4. Removing the virtual method in_vector::result_type(),
adding in_vector::type_handler() instead.
This helps to get result_type(), field_type(),
mysql_timestamp_type() of an in_vector easier.
Passing type_handler()->mysql_timestamp_type() as
a new parameter to Item_datetime::set() inside
in_temporal::value_to_item().
5. Cleaup: Removing separate implementations of in_datetime::get_value()
and in_time::get_value(). Adding a single implementation
in_temporal::get_value() instead.
Passing type_handler()->field_type() to get_value_internal().
2018-02-14 22:58:34 +04:00
..
2017-07-20 20:13:28 +02:00
2018-02-12 17:17:26 +02:00
2017-03-13 15:31:12 +01:00
2017-07-12 22:54:49 +04:00
2017-08-14 11:12:17 +04:00
2017-06-23 09:16:27 +02:00
2017-12-18 01:55:40 +04:00
2017-10-30 09:26:38 +04:00
2017-10-30 16:42:46 +04:00
2017-11-13 21:58:00 +04:00
2017-03-29 12:07:33 -07:00
2017-09-18 10:12:23 +02:00
2017-07-05 17:15:59 +02:00
2017-12-12 13:27:16 +02:00
2017-03-14 11:52:00 +01:00
2018-01-24 12:11:29 +04:00
2017-08-09 18:09:04 +05:30
2017-12-29 13:35:41 +02:00
2017-04-23 12:57:26 +04:00
2017-12-12 13:27:16 +02:00
2017-12-29 11:40:23 +04:00
2018-02-08 19:06:25 +04:00
2017-11-21 20:03:57 +01:00
2018-02-09 12:48:23 +02:00
2018-02-09 12:48:23 +02:00
2017-09-17 11:05:33 +03:00
2017-05-20 16:29:11 +04:00
2017-03-11 20:12:15 +00:00
2017-09-17 11:05:33 +03:00
2017-05-11 19:39:49 +04:00
2017-09-17 14:03:51 +03:00
2017-09-17 11:05:33 +03:00
2017-09-17 11:05:33 +03:00
2017-09-17 11:05:33 +03:00
2017-10-24 14:53:18 +02:00
2017-12-08 16:00:10 +02:00
2017-05-11 19:39:49 +04:00
2017-12-08 13:19:19 +04:00
2017-09-17 11:05:33 +03:00
2017-05-11 19:39:49 +04:00
2017-07-05 17:15:59 +02:00
2017-05-11 19:39:49 +04:00
2017-12-08 13:19:19 +04:00
2017-10-30 16:42:46 +04:00
2017-09-17 11:05:33 +03:00
2017-03-10 18:21:25 +01:00
2017-12-08 13:19:19 +04:00
2017-12-14 09:53:19 +02:00
2017-09-17 11:05:33 +03:00
2017-09-17 11:05:33 +03:00
2017-09-17 11:05:33 +03:00
2017-12-08 13:19:19 +04:00
2017-12-14 08:40:01 +02:00
2017-12-08 13:19:19 +04:00
2017-12-08 13:19:19 +04:00
2017-10-24 14:53:18 +02:00
2017-09-18 10:12:23 +02:00
2017-09-14 08:09:44 +03:00
2017-10-23 15:35:10 -07:00
2017-08-25 14:04:51 +02:00
2017-11-06 12:56:56 +00:00
2018-01-11 18:00:31 +02:00
2017-07-04 15:31:25 +04:00
2018-02-08 19:06:25 +04:00
2017-06-23 09:16:27 +02:00
2017-03-10 18:21:24 +01:00
2017-12-12 13:27:16 +02:00
2018-02-08 13:53:21 +02:00
2017-10-14 17:28:54 +04:00
2017-08-01 09:52:57 +02:00
2017-03-31 15:18:28 +04:00
2017-11-03 09:27:53 +04:00
2017-05-09 13:24:52 +02:00
2017-03-31 19:28:58 +02:00
2017-11-13 09:41:29 +01:00
2018-01-01 19:39:59 +02:00
2017-03-14 11:52:00 +01:00
2017-06-02 13:52:47 +03:00
2017-06-02 13:52:47 +03:00
2018-02-12 17:17:26 +02:00
2018-02-08 19:06:25 +04:00
2017-05-11 19:39:49 +04:00
2018-01-30 11:35:27 +04:00
2017-07-05 19:08:55 +02:00
2017-09-22 12:45:34 +04:00
2017-05-29 10:29:46 +04:00
2017-06-19 16:56:13 +03:00
2017-11-29 10:03:51 +04:00
2017-10-30 16:42:46 +04:00
2017-10-01 00:30:58 +04:00
2018-02-06 14:50:50 +01:00
2018-01-01 19:39:59 +02:00
2017-09-20 17:47:49 +03:00
2018-01-01 19:39:59 +02:00
2017-08-14 11:12:17 +04:00
2017-10-24 14:53:18 +02:00
2017-10-01 00:30:58 +04:00
2017-12-22 12:23:39 +02:00
2017-12-14 09:53:19 +02:00
2017-08-14 11:12:17 +04:00
2017-10-30 16:42:46 +04:00
2017-04-24 12:09:25 +04:00
2017-12-12 13:27:16 +02:00
2017-10-18 14:11:55 +04:00
2017-07-20 20:13:28 +02:00
2017-08-14 11:12:17 +04:00
2017-11-14 13:36:50 +04:00
2017-10-18 14:11:55 +04:00
2017-07-11 23:27:19 +04:00
2018-01-05 16:52:40 +02:00
2017-11-29 10:03:51 +04:00
2017-12-12 13:27:16 +02:00
2018-01-01 19:39:59 +02:00
2017-06-23 09:16:27 +02:00
2017-04-27 19:12:38 +02:00
2018-01-01 19:39:59 +02:00
2017-08-16 18:44:17 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2018-02-12 17:17:26 +02:00
2017-06-08 12:45:08 +03:00
2017-05-09 13:24:52 +02:00
2017-06-02 13:52:47 +03:00
2017-09-22 02:27:00 +02:00
2017-11-13 10:02:59 +01:00
2018-02-06 14:50:50 +01:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2018-01-01 19:39:59 +02:00
2018-01-01 19:39:59 +02:00
2017-07-07 12:43:10 +04:00
2017-04-30 14:58:11 +02:00
2017-04-05 15:02:56 +04:00
2017-05-24 15:43:09 +04:00
2017-06-15 15:27:11 +04:00
2017-05-09 13:24:52 +02:00
2017-12-13 13:22:45 +04:00
2017-09-23 20:22:46 +02:00
2017-03-10 18:21:25 +01:00
2017-09-19 12:43:02 +03:00
2017-03-30 12:48:42 +02:00
2017-08-15 14:13:42 +04:00
2017-04-01 14:15:18 +03:00
2017-10-03 20:23:34 +02:00
2017-10-23 15:33:13 -07:00
2018-01-23 17:29:58 +05:30
2017-06-19 16:46:34 +03:00
2017-07-05 17:15:57 +02:00
2018-02-12 17:17:26 +02:00
2017-05-24 15:43:09 +04:00
2017-05-17 00:00:27 +03:00
2017-05-17 00:00:27 +03:00
2017-10-03 20:23:33 +02:00
2017-10-03 20:23:34 +02:00
2017-08-01 09:52:59 +02:00
2017-03-14 11:52:00 +01:00
2017-05-09 13:24:52 +02:00
2017-03-14 11:52:00 +01:00
2018-02-06 14:50:50 +01:00
2017-03-03 20:12:48 +02:00
2018-02-12 17:17:26 +02:00
2017-03-10 18:21:25 +01:00
2017-03-10 18:21:25 +01:00
2017-03-10 18:21:25 +01:00
2017-03-10 18:21:25 +01:00
2017-03-30 12:48:42 +02:00
2017-08-17 11:38:34 +02:00
2017-06-30 13:28:39 +02:00
2017-12-29 13:35:41 +02:00
2017-12-29 13:35:41 +02:00
2017-03-30 12:48:42 +02:00
2017-12-29 13:35:41 +02:00
2017-09-28 18:42:14 +04:00
2017-11-05 22:23:31 +02:00
2018-02-06 14:50:50 +01:00
2018-02-12 17:17:26 +02:00
2017-07-05 19:08:55 +02:00
2017-04-01 14:15:18 +03:00
2017-05-04 11:38:55 +04:00
2017-05-27 16:45:22 +04:00
2017-09-22 13:58:00 +02:00
2018-01-02 02:03:12 +02:00
2017-08-08 09:56:38 +02:00
2017-08-08 09:56:38 +02:00
2017-11-10 14:01:29 -08:00
2018-02-06 14:50:50 +01:00
2017-04-05 15:02:38 +04:00
2017-07-05 19:08:55 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-07 12:43:10 +04:00
2017-10-24 14:53:18 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-07 12:43:10 +04:00
2017-07-05 17:15:59 +02:00
2018-02-12 17:17:26 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-07-05 17:15:59 +02:00
2017-09-19 12:43:02 +03:00
2017-07-05 17:15:59 +02:00
2017-12-25 15:18:21 +01:00
2018-02-12 17:17:26 +02:00
2017-04-27 19:12:38 +02:00
2017-12-12 13:27:16 +02:00
2018-02-12 17:17:26 +02:00
2017-05-24 15:43:09 +04:00
2017-05-24 15:43:09 +04:00
2017-05-24 15:43:09 +04:00
2017-05-24 15:43:09 +04:00
2018-02-12 17:17:26 +02:00
2018-02-12 17:17:26 +02:00
2018-02-06 14:50:50 +01:00
2017-05-05 16:43:25 +02:00
2017-03-16 10:18:02 +05:30
2017-09-18 10:12:23 +02:00
2017-05-11 19:39:49 +04:00
2017-10-24 14:53:18 +02:00
2017-10-06 00:08:36 -07:00
2017-05-11 19:39:49 +04:00
2017-10-24 14:53:18 +02:00
2017-06-02 13:52:47 +03:00
2017-03-11 16:23:31 +01:00
2018-02-12 17:17:26 +02:00
2018-02-12 17:17:26 +02:00
2018-02-12 17:17:26 +02:00
2018-02-12 17:17:26 +02:00
2017-08-10 14:26:29 -07:00
2017-08-10 14:26:29 -07:00
2018-02-12 17:17:26 +02:00
2018-02-12 17:17:26 +02:00
2017-11-05 22:23:31 +02:00
2017-10-10 16:16:12 +03:00
2017-03-31 19:28:58 +02:00
2017-05-05 07:00:18 +04:00
2017-12-12 13:27:16 +02:00
2017-12-12 13:27:16 +02:00
2017-10-27 20:48:16 +04:00
2017-10-27 20:48:16 +04:00
2017-10-27 20:48:16 +04:00
2017-11-16 14:33:28 +04:00
2017-11-16 14:33:28 +04:00
2017-08-14 19:45:59 +02:00
2017-12-12 13:27:16 +02:00
2017-11-16 14:33:28 +04:00
2017-12-12 13:27:16 +02:00
2017-12-07 15:54:27 +04:00
2017-04-07 13:40:27 +04:00
2017-07-28 12:30:30 +04:00
2017-05-25 14:12:18 +04:00
2018-02-08 19:06:25 +04:00
2017-10-14 17:28:54 +04:00
2017-08-08 09:56:38 +02:00
2017-05-11 17:28:47 +03:00
2017-05-11 17:28:47 +03:00
2017-08-14 19:45:59 +02:00
2017-03-14 11:52:00 +01:00
2017-10-24 14:53:18 +02:00
2017-03-14 11:52:00 +01:00
2017-05-26 19:32:28 +04:00
2017-05-26 19:32:28 +04:00
2017-05-26 19:32:28 +04:00
2017-03-14 11:52:00 +01:00
2017-11-09 23:21:41 +02:00
2017-03-14 11:52:00 +01:00
2017-06-08 12:45:08 +03:00
2017-10-30 16:42:46 +04:00
2017-07-07 12:43:10 +04:00
2018-01-11 18:00:31 +02:00
2018-01-11 18:00:31 +02:00
2018-01-11 18:00:31 +02:00
2018-01-11 18:00:31 +02:00
2018-01-11 18:00:31 +02:00
2017-07-12 10:39:02 +02:00
2017-03-14 11:52:00 +01:00
2017-07-07 12:43:10 +04:00
2017-06-15 15:27:11 +04:00
2017-07-07 12:43:10 +04:00
2017-06-15 15:27:11 +04:00
2018-01-11 18:00:31 +02:00
2017-03-30 12:48:42 +02:00
2017-03-30 12:48:42 +02:00
2017-09-19 12:43:02 +03:00
2017-10-14 17:28:54 +04:00
2017-10-14 17:28:54 +04:00
2017-10-14 17:28:54 +04:00
2017-10-14 17:28:54 +04:00
2017-03-31 16:40:29 +04:00
2017-10-04 18:36:30 +02:00
2017-05-15 23:45:31 +04:00
2018-02-01 09:01:15 +00:00
2017-03-30 12:48:42 +02:00
2017-11-29 12:06:48 +04:00
2017-11-08 13:12:11 +02:00
2017-10-22 13:03:41 +02:00
2017-11-09 23:21:41 +02:00
2017-07-07 12:43:10 +04:00
2018-02-14 22:58:34 +04:00
2017-04-25 14:22:07 +04:00
2017-05-02 11:39:20 +04:00
2017-10-18 14:11:55 +04:00
2017-08-14 19:45:59 +02:00
2017-05-11 19:39:49 +04:00
2017-08-14 19:45:59 +02:00
2017-05-22 13:44:26 +04:00
2017-11-15 14:34:04 +04:00
2018-02-11 13:47:16 +01:00
2017-05-10 08:30:56 +04:00
2018-02-14 22:58:34 +04:00
2017-05-10 08:30:56 +04:00
2017-05-11 19:39:49 +04:00
2017-10-24 14:53:18 +02:00
2017-04-07 18:09:56 +04:00
2017-04-07 18:09:56 +04:00
2018-02-08 19:06:25 +04:00
2018-02-02 10:09:44 +01:00
2017-10-03 20:23:34 +02:00
2017-10-02 22:35:13 +04:00
2017-03-14 11:52:00 +01:00
2017-10-02 22:35:13 +04:00
2018-02-12 17:17:26 +02:00
2017-08-30 14:37:16 +00:00
2017-12-12 13:27:16 +02:00
2017-09-19 15:14:10 +03:00
2017-05-27 16:39:20 +04:00
2017-09-19 15:14:10 +03:00
2018-01-23 17:43:12 +04:00
2018-02-08 19:06:25 +04:00
2018-02-06 14:50:50 +01:00