forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu): add the TIME_to_ulonglong_time_round logic, and fix up p…
…recision loss problem and value overflow problem (stoneatom#1173) When converting TIME or DATETIME to ulonglong numeric, the tianmu engine has not the TIME_to_ulonglong_time_round logic.Which causes the results different from innodb.Furthermore, i found another bug during processing the issue.When we close the tianmu_insert_delayed parameter, the TIME or DATETIME or TIMESTAMP type's data will loss precision when executing insert sql. PR Close stoneatom#1173
- Loading branch information
1 parent
288262f
commit c99b8d7
Showing
5 changed files
with
75 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
DROP DATABASE IF EXISTS issue1173; | ||
CREATE DATABASE issue1173; | ||
USE issue1173; | ||
CREATE TABLE t1 (a TIME(1) NOT NULL); | ||
INSERT INTO t1 VALUES ('00:00:02.9'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t1; | ||
a a & a a | a a^0 a<<1 a<<0 a>>1 bit_count(a) | ||
00:00:02.9 3 3 3 6 3 1 2 | ||
CREATE TABLE t2 (a DATETIME(1) NOT NULL); | ||
INSERT INTO t2 VALUES ('2001-01-01 00:00:02.9'); | ||
INSERT INTO t2 VALUES ('2001-01-01 23:59:59.9'); | ||
INSERT INTO t2 VALUES ('9999-12-31 23:59:59.9'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t2; | ||
a a & a a | a a^0 a<<1 a<<0 a>>1 bit_count(a) | ||
2001-01-01 00:00:02.9 20010101000003 20010101000003 20010101000003 40020202000006 20010101000003 10005050500001 24 | ||
2001-01-01 23:59:59.9 20010102000000 20010102000000 20010102000000 40020204000000 20010102000000 10005051000000 18 | ||
9999-12-31 23:59:59.9 99991231000000 99991231000000 99991231000000 199982462000000 99991231000000 49995615500000 24 | ||
CREATE TABLE t3 (a VARCHAR(30) NOT NULL); | ||
INSERT INTO t3 VALUES ('18446744073709551610'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t3; | ||
a a & a a | a a^0 a<<1 a<<0 a>>1 bit_count(a) | ||
18446744073709551610 9223372036854775807 9223372036854775807 9223372036854775807 18446744073709551614 9223372036854775807 4611686018427387903 63 | ||
DROP TABLE t1; | ||
DROP TABLE t2; | ||
DROP TABLE t3; | ||
DROP DATABASE issue1173; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--source include/have_tianmu.inc | ||
--disable_warnings | ||
|
||
DROP DATABASE IF EXISTS issue1173; | ||
CREATE DATABASE issue1173; | ||
USE issue1173; | ||
|
||
CREATE TABLE t1 (a TIME(1) NOT NULL); | ||
INSERT INTO t1 VALUES ('00:00:02.9'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t1; | ||
|
||
CREATE TABLE t2 (a DATETIME(1) NOT NULL); | ||
INSERT INTO t2 VALUES ('2001-01-01 00:00:02.9'); | ||
INSERT INTO t2 VALUES ('2001-01-01 23:59:59.9'); | ||
INSERT INTO t2 VALUES ('9999-12-31 23:59:59.9'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t2; | ||
|
||
CREATE TABLE t3 (a VARCHAR(30) NOT NULL); | ||
INSERT INTO t3 VALUES ('18446744073709551610'); | ||
SELECT a, a & a, a | a, a^0, a<<1, a<<0, a>>1, bit_count(a) FROM t3; | ||
|
||
DROP TABLE t1; | ||
DROP TABLE t2; | ||
DROP TABLE t3; | ||
|
||
DROP DATABASE issue1173; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters