You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
bug(priproc) make last_day type a bit more accurate
This fixes discrepance with the server, which assigns DATE type to last_day()'s result. Now we also assigns DATE result type and, also, use proper dataconvert::Day data structure to return date. Tests agree with InnoDB. Also, this patch includes test for MCOL-5669, to show we fixed it.
This commit is contained in:
committed by
Leonid Fedorov
parent
ef451af860
commit
bfe49a8345
113
mysql-test/columnstore/bugfixes/mcol-5669.result
Normal file
113
mysql-test/columnstore/bugfixes/mcol-5669.result
Normal file
File diff suppressed because one or more lines are too long
112
mysql-test/columnstore/bugfixes/mcol-5669.test
Normal file
112
mysql-test/columnstore/bugfixes/mcol-5669.test
Normal file
File diff suppressed because one or more lines are too long
18
mysql-test/columnstore/bugfixes/mcol-5670.result
Normal file
18
mysql-test/columnstore/bugfixes/mcol-5670.result
Normal file
@ -0,0 +1,18 @@
|
||||
DROP DATABASE IF EXISTS mcol_5670;
|
||||
CREATE DATABASE mcol_5670;
|
||||
USE mcol_5670;
|
||||
create table my_colstore_tab(`yyyymmdd` date DEFAULT NULL) engine=COLUMNSTORE;
|
||||
insert into my_colstore_tab values(date('2024-03-18'));
|
||||
insert into my_colstore_tab values(date(date('2024-03-18')-interval 1 year));
|
||||
select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as OK_3 from my_colstore_tab s;
|
||||
OK_1 OK_2 OK_3
|
||||
18 2024-03-31 31
|
||||
18 2023-03-31 31
|
||||
create table my_colstore_tab2(`yyyymmdd` datetime DEFAULT NULL) engine=COLUMNSTORE;
|
||||
insert into my_colstore_tab2 values('2024-03-18 13:40:31');
|
||||
insert into my_colstore_tab2 values('2024-03-18 13:40:31'-interval 1 year);
|
||||
select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as OK_3 from my_colstore_tab2 s;
|
||||
OK_1 OK_2 OK_3
|
||||
18 2024-03-31 31
|
||||
18 2023-03-31 31
|
||||
DROP DATABASE mcol_5670;
|
21
mysql-test/columnstore/bugfixes/mcol-5670.test
Normal file
21
mysql-test/columnstore/bugfixes/mcol-5670.test
Normal file
@ -0,0 +1,21 @@
|
||||
--source ../include/have_columnstore.inc
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mcol_5670;
|
||||
--enable_warnings
|
||||
CREATE DATABASE mcol_5670;
|
||||
USE mcol_5670;
|
||||
|
||||
|
||||
# using lastday with DATE type
|
||||
create table my_colstore_tab(`yyyymmdd` date DEFAULT NULL) engine=COLUMNSTORE;
|
||||
insert into my_colstore_tab values(date('2024-03-18'));
|
||||
insert into my_colstore_tab values(date(date('2024-03-18')-interval 1 year));
|
||||
select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as OK_3 from my_colstore_tab s;
|
||||
|
||||
# using lastday with DATETIME type
|
||||
create table my_colstore_tab2(`yyyymmdd` datetime DEFAULT NULL) engine=COLUMNSTORE;
|
||||
insert into my_colstore_tab2 values('2024-03-18 13:40:31');
|
||||
insert into my_colstore_tab2 values('2024-03-18 13:40:31'-interval 1 year);
|
||||
select day(s.yyyymmdd) as OK_1, last_day(s.yyyymmdd) as OK_2, day(last_day(s.yyyymmdd)) as OK_3 from my_colstore_tab2 s;
|
||||
|
||||
DROP DATABASE mcol_5670;
|
Reference in New Issue
Block a user