-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
fix(tianmu): fix storage of DT type #1752
fix(tianmu): fix storage of DT type #1752
Conversation
Thanks for the contribution! Please review the labels and make any necessary changes. |
Very good, this seems like a great solution, but it seems to require some test cases to ensure the correctness of the modifications |
I've write a simple MTR test file --source include/have_tianmu.inc
--disable_warnings
DROP DATABASE IF EXISTS issue1175_test;
--enable_warnings
CREATE DATABASE issue1175_test;
USE issue1175_test;
--disable_warnings
CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
t TIME,
d DATE,
dt DATETIME,
ts TIMESTAMP
) ENGINE=TIANMU;
INSERT INTO t1 (t, d, dt, ts) VALUES
('00:00:00', '2000-01-01', '2000-01-01 00:00:00', '2000-01-01 00:00:00'),
('-838:59:59', '2001-02-28', '2001-02-28 00:00:00', '2001-02-28 00:00:00'),
('838:59:59', '2002-03-31', '2002-03-31 23:59:59', '2002-03-31 23:59:59'),
('-100:00:00', '2010-12-31', '2010-12-31 12:34:56', '2010-12-31 12:34:56'),
('200:00:00', '2011-11-30', '2011-11-30 18:00:00', '2011-11-30 18:00:00'),
('-400:00:00', '2012-02-29', '2012-02-29 01:23:45', '2012-02-29 01:23:45'),
('720:00:00', '2020-10-31', '2020-10-31 14:00:00', '2020-10-31 14:00:00'),
('05:30:15', '1985-04-12', '1985-04-12 05:30:15.123', '1985-04-12 05:30:15.123'),
('-23:45:01', '1995-08-24', '1995-08-24 15:45:30.987', '1995-08-24 15:45:30.987'),
('67:15:45', '2005-06-15', '2005-06-15 10:59:59.001', '2005-06-15 10:59:59.001'),
('-115:00:00', '2007-12-25', '2007-12-25 23:30:45.500', '2007-12-25 23:30:45.500'),
('350:30:15', '2015-09-05', '2015-09-05 12:00:00.999', '2015-09-05 12:00:00.999'),
('-500:45:30', '2017-03-01', '2017-03-01 01:23:45.250', '2017-03-01 01:23:45.250'),
('600:15:00', '2021-05-01', '2021-05-01 17:30:00.123', '2021-05-01 17:30:00.123');
SELECT * FROM t1 ORDER BY id;
DROP DATABASE issue1175_test; If we directly put these cmds into a stonedb instance, the select result is correct.
This Issue still only occurs when we use tianmu engine, and it performs the same before and after my change. I'm not sure if this worth a new issue or it's a part of the old issue. |
… TIME type from other time types
I think the case of incorrect test performance mentioned in my last comment is also part of this issue. And it can be fixed by distinguish between them correctly in |
I notice test |
I try to re-run failed test, mtr in centos is OK now, |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## stonedb-5.7-dev #1752 +/- ##
===================================================
- Coverage 55.18% 55.09% -0.09%
===================================================
Files 2031 2031
Lines 431436 431448 +12
===================================================
- Hits 238081 237704 -377
- Misses 193355 193744 +389
☔ View full report in Codecov by Sentry. |
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
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
Summary about this PR
fix: fix storage of DT type (#1175)
This issue actually only occurs when we use tianmu engine.
In the implemtation of tianmu engine,
DATETIME
andTIME
share same data structDT
However, we didn't distinguish between them correctly when storing:
For instace, if we store
TIME: 32:00:00
, my_time->day will be 1, instead of 0 (hour
part takes 5 bit), and the select result will be56:00:00
I changed the code segment to:
Tests Check List
Manual test scripts :
output:
Changelog
Documentation