Skip to content

Commit

Permalink
test(mtr):add double_float and func_sec_to_time(stoneatom#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
shangyanwen authored and konghaiya committed Mar 7, 2023
1 parent 33fc150 commit 36f2c76
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 0 deletions.
100 changes: 100 additions & 0 deletions mysql-test/suite/tianmu/r/double_float.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# Some double/float tests moved from regr.
# DML, DQL w/without filters
#
DROP DATABASE IF EXISTS `double_float`;
CREATE DATABASE `double_float`;
USE `double_float`;
SET default_storage_engine=tianmu;
SELECT @@default_storage_engine;
@@default_storage_engine
TIANMU
set autocommit=0;
CREATE TABLE test1 (dkey int);
INSERT INTO test1 VALUES (1), (2), (3);
SELECT test1.dkey FROM test1 ORDER BY test1.dkey;
dkey
CREATE TABLE qatabledouble (col DOUBLE) ;
CREATE TABLE qatablefloat (col float) ;
INSERT INTO qatabledouble VALUES (-2.225073858507201E-307);
INSERT INTO qatabledouble VALUES (-1.807302187774382E-127);
INSERT INTO qatabledouble VALUES (0);
INSERT INTO qatabledouble VALUES (1.993777023789432E+21);
INSERT INTO qatabledouble VALUES (1.797693134862315E+38);
INSERT INTO qatabledouble VALUES (-19937770237894323221);
INSERT INTO qatabledouble VALUES (17976931348623158);
SELECT * FROM qatabledouble;
col
INSERT INTO qatabledouble VALUES (null);
INSERT INTO qatabledouble VALUES (null);
INSERT INTO qatabledouble VALUES (null);
SELECT * FROM qatabledouble;
col
INSERT INTO qatablefloat VALUES (null);
INSERT INTO qatablefloat VALUES (null);
INSERT INTO qatablefloat VALUES (null);
SELECT * FROM qatablefloat;
col
DELETE FROM qatabledouble WHERE col IS NULL;
SELECT * FROM qatabledouble;
col
delete FROM qatablefloat WHERE col IS NULL;
SELECT * FROM qatablefloat;
col
CREATE TABLE qatabledouble_v2 (col1 DOUBLE, col2 DOUBLE, col3 DOUBLE) ;
INSERT INTO qatabledouble_v2 VALUES (-0.50, -0.50, -0.50);
INSERT INTO qatabledouble_v2 VALUES (-0.49, -0.49, -0.49);
INSERT INTO qatabledouble_v2 VALUES (0.49, 0.49, 0.49);
INSERT INTO qatabledouble_v2 VALUES (0.50, 0.50, 0.50);
INSERT INTO qatabledouble_v2 VALUES (+8,+8,+8);
INSERT INTO qatabledouble_v2 VALUES (+0.50,+0.50,+0.50);
INSERT INTO qatabledouble_v2 VALUES (+0.49,+0.49,+0.49);
INSERT INTO qatabledouble_v2 VALUES (+0.0,+0.0,+0.0);
INSERT INTO qatabledouble_v2 VALUES (+.50,+.50,+.50);
INSERT INTO qatabledouble_v2 VALUES (+.49,+.49,+.49);
INSERT INTO qatabledouble_v2 VALUES (+.0,+.0,+.0);
INSERT INTO qatabledouble_v2 VALUES (-.0,-.0,-.0);
INSERT INTO qatabledouble_v2 VALUES (-.49,-.49,-.49);
INSERT INTO qatabledouble_v2 VALUES (-.50,-.50,-.50);
INSERT INTO qatabledouble_v2 VALUES (-0.0,-0.0,-0.0);
INSERT INTO qatabledouble_v2 VALUES (-0.49,-0.49,-0.49);
INSERT INTO qatabledouble_v2 VALUES (-0.50,-0.50,-0.50);
INSERT INTO qatabledouble_v2 VALUES (-8,-8,-8);
INSERT INTO qatabledouble_v2 VALUES (8,8,8);
INSERT INTO qatabledouble_v2 VALUES (0.50,0.50,0.50);
INSERT INTO qatabledouble_v2 VALUES (0.49,0.49,0.49);
INSERT INTO qatabledouble_v2 VALUES (0.0,0.0,0.0);
INSERT INTO qatabledouble_v2 VALUES (.50,.50,.50);
INSERT INTO qatabledouble_v2 VALUES (.49,.49,.49);
INSERT INTO qatabledouble_v2 VALUES (.0,.0,.0);
SELECT * FROM qatabledouble_v2;
col1 col2 col3
CREATE TABLE qatablefloat_v3 (col1 float, col2 float, col3 float) ;
INSERT INTO qatablefloat_v3 VALUES (-0.50, -0.50, -0.50);
INSERT INTO qatablefloat_v3 VALUES (-0.49, -0.49, -0.49);
INSERT INTO qatablefloat_v3 VALUES (0.49, 0.49, 0.49);
INSERT INTO qatablefloat_v3 VALUES (0.50, 0.50, 0.50);
INSERT INTO qatablefloat_v3 VALUES (+8,+8,+8);
INSERT INTO qatablefloat_v3 VALUES (+0.50,+0.50,+0.50);
INSERT INTO qatablefloat_v3 VALUES (+0.49,+0.49,+0.49);
INSERT INTO qatablefloat_v3 VALUES (+0.0,+0.0,+0.0);
INSERT INTO qatablefloat_v3 VALUES (+.50,+.50,+.50);
INSERT INTO qatablefloat_v3 VALUES (+.49,+.49,+.49);
INSERT INTO qatablefloat_v3 VALUES (+.0,+.0,+.0);
INSERT INTO qatablefloat_v3 VALUES (-.0,-.0,-.0);
INSERT INTO qatablefloat_v3 VALUES (-.49,-.49,-.49);
INSERT INTO qatablefloat_v3 VALUES (-.50,-.50,-.50);
INSERT INTO qatablefloat_v3 VALUES (-0.0,-0.0,-0.0);
INSERT INTO qatablefloat_v3 VALUES (-0.49,-0.49,-0.49);
INSERT INTO qatablefloat_v3 VALUES (-0.50,-0.50,-0.50);
INSERT INTO qatablefloat_v3 VALUES (-8,-8,-8);
INSERT INTO qatablefloat_v3 VALUES (8,8,8);
INSERT INTO qatablefloat_v3 VALUES (0.50,0.50,0.50);
INSERT INTO qatablefloat_v3 VALUES (0.49,0.49,0.49);
INSERT INTO qatablefloat_v3 VALUES (0.0,0.0,0.0);
INSERT INTO qatablefloat_v3 VALUES (.50,.50,.50);
INSERT INTO qatablefloat_v3 VALUES (.49,.49,.49);
INSERT INTO qatablefloat_v3 VALUES (.0,.0,.0);
SELECT * FROM qatablefloat_v3;
col1 col2 col3
DROP DATABASE `double_float`;
18 changes: 18 additions & 0 deletions mysql-test/suite/tianmu/r/func_sec_to_time.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# SEC_TO_TIME(double_or_float)
#
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0.000025e-35);
INSERT INTO t1 VALUES (-1),(1);
INSERT INTO t1 VALUES (-900),(900);
INSERT INTO t1 VALUES (-1000000),(1000000);
SELECT a, SEC_TO_TIME(a) FROM t1 ORDER BY 1;
a SEC_TO_TIME(a)
-1000000 -277:46:40.000000
-900 -00:15:00.000000
-1 -00:00:01.000000
2.5e-40 00:00:00.000000
1 00:00:01.000000
900 00:15:00.000000
1000000 277:46:40.000000
DROP TABLE t1;
99 changes: 99 additions & 0 deletions mysql-test/suite/tianmu/t/double_float.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
--source include/have_tianmu.inc
--echo #
--echo # Some double/float tests moved from regr.
--echo # DML, DQL w/without filters
--echo #

--disable_warnings
DROP DATABASE IF EXISTS `double_float`;
--enable_warnings
CREATE DATABASE `double_float`;
USE `double_float`;

SET default_storage_engine=tianmu;
SELECT @@default_storage_engine;

set autocommit=0;

CREATE TABLE test1 (dkey int);
INSERT INTO test1 VALUES (1), (2), (3);
SELECT test1.dkey FROM test1 ORDER BY test1.dkey;

CREATE TABLE qatabledouble (col DOUBLE) ;
CREATE TABLE qatablefloat (col float) ;
INSERT INTO qatabledouble VALUES (-2.225073858507201E-307); # Changed -308 to -307, -308 errors on qaftest7.
INSERT INTO qatabledouble VALUES (-1.807302187774382E-127);
INSERT INTO qatabledouble VALUES (0);
INSERT INTO qatabledouble VALUES (1.993777023789432E+21);
INSERT INTO qatabledouble VALUES (1.797693134862315E+38);
INSERT INTO qatabledouble VALUES (-19937770237894323221);
INSERT INTO qatabledouble VALUES (17976931348623158);
SELECT * FROM qatabledouble;
INSERT INTO qatabledouble VALUES (null);
INSERT INTO qatabledouble VALUES (null);
INSERT INTO qatabledouble VALUES (null);
SELECT * FROM qatabledouble;
INSERT INTO qatablefloat VALUES (null);
INSERT INTO qatablefloat VALUES (null);
INSERT INTO qatablefloat VALUES (null);
SELECT * FROM qatablefloat;
DELETE FROM qatabledouble WHERE col IS NULL;
SELECT * FROM qatabledouble;
delete FROM qatablefloat WHERE col IS NULL;
SELECT * FROM qatablefloat;
CREATE TABLE qatabledouble_v2 (col1 DOUBLE, col2 DOUBLE, col3 DOUBLE) ;
INSERT INTO qatabledouble_v2 VALUES (-0.50, -0.50, -0.50);
INSERT INTO qatabledouble_v2 VALUES (-0.49, -0.49, -0.49);
INSERT INTO qatabledouble_v2 VALUES (0.49, 0.49, 0.49);
INSERT INTO qatabledouble_v2 VALUES (0.50, 0.50, 0.50);
INSERT INTO qatabledouble_v2 VALUES (+8,+8,+8);
INSERT INTO qatabledouble_v2 VALUES (+0.50,+0.50,+0.50);
INSERT INTO qatabledouble_v2 VALUES (+0.49,+0.49,+0.49);
INSERT INTO qatabledouble_v2 VALUES (+0.0,+0.0,+0.0);
INSERT INTO qatabledouble_v2 VALUES (+.50,+.50,+.50);
INSERT INTO qatabledouble_v2 VALUES (+.49,+.49,+.49);
INSERT INTO qatabledouble_v2 VALUES (+.0,+.0,+.0);
INSERT INTO qatabledouble_v2 VALUES (-.0,-.0,-.0);
INSERT INTO qatabledouble_v2 VALUES (-.49,-.49,-.49);
INSERT INTO qatabledouble_v2 VALUES (-.50,-.50,-.50);
INSERT INTO qatabledouble_v2 VALUES (-0.0,-0.0,-0.0);
INSERT INTO qatabledouble_v2 VALUES (-0.49,-0.49,-0.49);
INSERT INTO qatabledouble_v2 VALUES (-0.50,-0.50,-0.50);
INSERT INTO qatabledouble_v2 VALUES (-8,-8,-8);
INSERT INTO qatabledouble_v2 VALUES (8,8,8);
INSERT INTO qatabledouble_v2 VALUES (0.50,0.50,0.50);
INSERT INTO qatabledouble_v2 VALUES (0.49,0.49,0.49);
INSERT INTO qatabledouble_v2 VALUES (0.0,0.0,0.0);
INSERT INTO qatabledouble_v2 VALUES (.50,.50,.50);
INSERT INTO qatabledouble_v2 VALUES (.49,.49,.49);
INSERT INTO qatabledouble_v2 VALUES (.0,.0,.0);
SELECT * FROM qatabledouble_v2;
CREATE TABLE qatablefloat_v3 (col1 float, col2 float, col3 float) ;
INSERT INTO qatablefloat_v3 VALUES (-0.50, -0.50, -0.50);
INSERT INTO qatablefloat_v3 VALUES (-0.49, -0.49, -0.49);
INSERT INTO qatablefloat_v3 VALUES (0.49, 0.49, 0.49);
INSERT INTO qatablefloat_v3 VALUES (0.50, 0.50, 0.50);
INSERT INTO qatablefloat_v3 VALUES (+8,+8,+8);
INSERT INTO qatablefloat_v3 VALUES (+0.50,+0.50,+0.50);
INSERT INTO qatablefloat_v3 VALUES (+0.49,+0.49,+0.49);
INSERT INTO qatablefloat_v3 VALUES (+0.0,+0.0,+0.0);
INSERT INTO qatablefloat_v3 VALUES (+.50,+.50,+.50);
INSERT INTO qatablefloat_v3 VALUES (+.49,+.49,+.49);
INSERT INTO qatablefloat_v3 VALUES (+.0,+.0,+.0);
INSERT INTO qatablefloat_v3 VALUES (-.0,-.0,-.0);
INSERT INTO qatablefloat_v3 VALUES (-.49,-.49,-.49);
INSERT INTO qatablefloat_v3 VALUES (-.50,-.50,-.50);
INSERT INTO qatablefloat_v3 VALUES (-0.0,-0.0,-0.0);
INSERT INTO qatablefloat_v3 VALUES (-0.49,-0.49,-0.49);
INSERT INTO qatablefloat_v3 VALUES (-0.50,-0.50,-0.50);
INSERT INTO qatablefloat_v3 VALUES (-8,-8,-8);
INSERT INTO qatablefloat_v3 VALUES (8,8,8);
INSERT INTO qatablefloat_v3 VALUES (0.50,0.50,0.50);
INSERT INTO qatablefloat_v3 VALUES (0.49,0.49,0.49);
INSERT INTO qatablefloat_v3 VALUES (0.0,0.0,0.0);
INSERT INTO qatablefloat_v3 VALUES (.50,.50,.50);
INSERT INTO qatablefloat_v3 VALUES (.49,.49,.49);
INSERT INTO qatablefloat_v3 VALUES (.0,.0,.0);
SELECT * FROM qatablefloat_v3;

DROP DATABASE `double_float`;
12 changes: 12 additions & 0 deletions mysql-test/suite/tianmu/t/func_sec_to_time.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--source include/have_tianmu.inc
--echo #
--echo # SEC_TO_TIME(double_or_float)
--echo #

CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (0.000025e-35);
INSERT INTO t1 VALUES (-1),(1);
INSERT INTO t1 VALUES (-900),(900);
INSERT INTO t1 VALUES (-1000000),(1000000);
SELECT a, SEC_TO_TIME(a) FROM t1 ORDER BY 1;
DROP TABLE t1;

0 comments on commit 36f2c76

Please sign in to comment.