From bfb68a073607604d13f98e862571957efb96089e Mon Sep 17 00:00:00 2001 From: shangyanwen <18392868125@163.com> Date: Wed, 26 Oct 2022 17:18:13 +0800 Subject: [PATCH] test(mtr):add xx_function.test(#497) --- mysql-test/suite/tianmu/r/avg_function.result | 26 ++++++++++ .../suite/tianmu/r/dayname_function.result | 32 +++++++++++++ .../suite/tianmu/r/dayofmonth_function.result | 32 +++++++++++++ .../suite/tianmu/r/dayofyear_function.result | 32 +++++++++++++ mysql-test/suite/tianmu/r/max_function.result | 26 ++++++++++ mysql-test/suite/tianmu/r/md5_function.result | 48 +++++++++++++++++++ mysql-test/suite/tianmu/r/min_function.result | 26 ++++++++++ mysql-test/suite/tianmu/r/sum_function.result | 26 ++++++++++ mysql-test/suite/tianmu/t/avg_function.test | 24 ++++++++++ .../suite/tianmu/t/dayname_function.test | 26 ++++++++++ .../suite/tianmu/t/dayofmonth_function.test | 26 ++++++++++ .../suite/tianmu/t/dayofyear_function.test | 26 ++++++++++ mysql-test/suite/tianmu/t/max_function.test | 24 ++++++++++ mysql-test/suite/tianmu/t/md5_function.test | 38 +++++++++++++++ mysql-test/suite/tianmu/t/min_function.test | 24 ++++++++++ mysql-test/suite/tianmu/t/sum_function.test | 24 ++++++++++ 16 files changed, 460 insertions(+) create mode 100644 mysql-test/suite/tianmu/r/avg_function.result create mode 100644 mysql-test/suite/tianmu/r/dayname_function.result create mode 100644 mysql-test/suite/tianmu/r/dayofmonth_function.result create mode 100644 mysql-test/suite/tianmu/r/dayofyear_function.result create mode 100644 mysql-test/suite/tianmu/r/max_function.result create mode 100644 mysql-test/suite/tianmu/r/md5_function.result create mode 100644 mysql-test/suite/tianmu/r/min_function.result create mode 100644 mysql-test/suite/tianmu/r/sum_function.result create mode 100644 mysql-test/suite/tianmu/t/avg_function.test create mode 100644 mysql-test/suite/tianmu/t/dayname_function.test create mode 100644 mysql-test/suite/tianmu/t/dayofmonth_function.test create mode 100644 mysql-test/suite/tianmu/t/dayofyear_function.test create mode 100644 mysql-test/suite/tianmu/t/max_function.test create mode 100644 mysql-test/suite/tianmu/t/md5_function.test create mode 100644 mysql-test/suite/tianmu/t/min_function.test create mode 100644 mysql-test/suite/tianmu/t/sum_function.test diff --git a/mysql-test/suite/tianmu/r/avg_function.result b/mysql-test/suite/tianmu/r/avg_function.result new file mode 100644 index 000000000..ce41ed9f2 --- /dev/null +++ b/mysql-test/suite/tianmu/r/avg_function.result @@ -0,0 +1,26 @@ +# +# Test AVG as distributed aggregate function +# Author: syw +# +DROP DATABASE IF EXISTS mcs188_db; +CREATE DATABASE mcs188_db; +USE mcs188_db; +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +SELECT AVG(DISTINCT a) FROM t1; +AVG(DISTINCT a) +4.1667 +SELECT AVG(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +AVG(DISTINCT a) +2.6667 +SELECT b, AVG(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +b AVG(DISTINCT a) +eee 7.0000 +ddd 5.0000 +ccc 1.0000 +aaa 2.6667 + NULL +SELECT AVG(a) FROM t1; +AVG(a) +3.7143 +DROP DATABASE mcs188_db; diff --git a/mysql-test/suite/tianmu/r/dayname_function.result b/mysql-test/suite/tianmu/r/dayname_function.result new file mode 100644 index 000000000..83047cf92 --- /dev/null +++ b/mysql-test/suite/tianmu/r/dayname_function.result @@ -0,0 +1,32 @@ +# +# Test DAYNAME function +# Author: syw +# +DROP DATABASE IF EXISTS mcs185_db; +CREATE DATABASE mcs185_db; +USE mcs185_db; +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-10-10 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` date DEFAULT NULL, + `b` datetime DEFAULT NULL +) ENGINE=TIANMU DEFAULT CHARSET=latin1 +SELECT DAYNAME('1212-12-12 11:11:11'); +DAYNAME('1212-12-12 11:11:11') +Wednesday +SELECT DAYNAME('2020-12-22'); +DAYNAME('2020-12-22') +Tuesday +SELECT a, DAYNAME(a) FROM t1 ORDER BY 1; +a DAYNAME(a) +1212-12-12 Wednesday +1990-10-10 Wednesday +3333-03-03 Tuesday +SELECT b, DAYNAME(b) FROM t1 ORDER BY 1; +b DAYNAME(b) +1212-12-11 11:11:11 Tuesday +1990-10-10 00:00:00 Wednesday +3333-03-04 03:33:33 Wednesday +DROP DATABASE mcs185_db; diff --git a/mysql-test/suite/tianmu/r/dayofmonth_function.result b/mysql-test/suite/tianmu/r/dayofmonth_function.result new file mode 100644 index 000000000..9e7110f05 --- /dev/null +++ b/mysql-test/suite/tianmu/r/dayofmonth_function.result @@ -0,0 +1,32 @@ +# +# Test DAYOFMONTH function +# Author: syw +# +DROP DATABASE IF EXISTS mcs187_db; +CREATE DATABASE mcs187_db; +USE mcs187_db; +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-01-01 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` date DEFAULT NULL, + `b` datetime DEFAULT NULL +) ENGINE=TIANMU DEFAULT CHARSET=latin1 +SELECT DAYOFMONTH('1212-12-12 11:11:11'); +DAYOFMONTH('1212-12-12 11:11:11') +12 +SELECT DAYOFMONTH('2020-12-22'); +DAYOFMONTH('2020-12-22') +22 +SELECT a, DAYOFMONTH(a) FROM t1 ORDER BY 1; +a DAYOFMONTH(a) +1212-12-12 12 +1990-10-10 10 +3333-03-03 3 +SELECT b, DAYOFMONTH(b) FROM t1 ORDER BY 1; +b DAYOFMONTH(b) +1212-12-11 11:11:11 11 +1990-01-01 00:00:00 1 +3333-03-04 03:33:33 4 +DROP DATABASE mcs187_db; diff --git a/mysql-test/suite/tianmu/r/dayofyear_function.result b/mysql-test/suite/tianmu/r/dayofyear_function.result new file mode 100644 index 000000000..644eb1e8b --- /dev/null +++ b/mysql-test/suite/tianmu/r/dayofyear_function.result @@ -0,0 +1,32 @@ +# +# Test DAYOFYEAR function +# Author: syw +# +DROP DATABASE IF EXISTS mcs186_db; +CREATE DATABASE mcs186_db; +USE mcs186_db; +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-10-10 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` date DEFAULT NULL, + `b` datetime DEFAULT NULL +) ENGINE=TIANMU DEFAULT CHARSET=latin1 +SELECT DAYOFYEAR('1212-12-12 11:11:11'); +DAYOFYEAR('1212-12-12 11:11:11') +347 +SELECT DAYOFYEAR('2020-12-22'); +DAYOFYEAR('2020-12-22') +357 +SELECT a, DAYOFYEAR(a) FROM t1 ORDER BY 1; +a DAYOFYEAR(a) +1212-12-12 347 +1990-10-10 283 +3333-03-03 62 +SELECT b, DAYOFYEAR(b) FROM t1 ORDER BY 1; +b DAYOFYEAR(b) +1212-12-11 11:11:11 346 +1990-10-10 00:00:00 283 +3333-03-04 03:33:33 63 +DROP DATABASE mcs186_db; diff --git a/mysql-test/suite/tianmu/r/max_function.result b/mysql-test/suite/tianmu/r/max_function.result new file mode 100644 index 000000000..cf97c66f3 --- /dev/null +++ b/mysql-test/suite/tianmu/r/max_function.result @@ -0,0 +1,26 @@ +# +# Test MAX as distributed aggregate function +# Author: syw +# +DROP DATABASE IF EXISTS mcs190_db; +CREATE DATABASE mcs190_db; +USE mcs190_db; +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +SELECT MAX(DISTINCT a) FROM t1; +MAX(DISTINCT a) +7 +SELECT MAX(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +MAX(DISTINCT a) +5 +SELECT b, MAX(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +b MAX(DISTINCT a) +eee 7 +ddd 6 +ccc 1 +aaa 5 + NULL +SELECT MAX(a) FROM t1; +MAX(a) +7 +DROP DATABASE mcs190_db; diff --git a/mysql-test/suite/tianmu/r/md5_function.result b/mysql-test/suite/tianmu/r/md5_function.result new file mode 100644 index 000000000..7f27eae54 --- /dev/null +++ b/mysql-test/suite/tianmu/r/md5_function.result @@ -0,0 +1,48 @@ +# +# Test MD5() function +# Author: syw +# +DROP DATABASE IF EXISTS mcs218_db; +CREATE DATABASE mcs218_db; +USE mcs218_db; +CREATE TABLE t1 +( +t1_BIGINT BIGINT, +t1_DOUBLE DOUBLE, +t1_FLOAT FLOAT, +t1_BLOB BLOB, +t1_TEXT TEXT, +t1_CHAR_1 CHAR(1), +t1_DATETIME DATETIME +)ENGINE=tianmu; +INSERT INTO t1 VALUES(NULL, NULL, NULL, '', '', '', '1990-10-01'); +INSERT INTO t1 VALUES(203685477580676, -3.797693231E+108, -7.402866E+18, repeat('b',10), repeat('b',10), 'b', '2387-11-08 11:22:30.123'); +SELECT t1_BIGINT, MD5(t1_BIGINT) FROM t1 ORDER BY t1_BIGINT; +t1_BIGINT MD5(t1_BIGINT) +NULL NULL +203685477580676 9e05a00575dbbdb0e9c03d479cea5eb9 +SELECT t1_DOUBLE, MD5(t1_DOUBLE) FROM t1 ORDER BY t1_DOUBLE; +t1_DOUBLE MD5(t1_DOUBLE) +NULL NULL +-3.797693231e108 bba02430bfe020a8d8ddffaff6b04004 +SELECT t1_FLOAT, MD5(t1_FLOAT) FROM t1 ORDER BY t1_FLOAT; +t1_FLOAT MD5(t1_FLOAT) +NULL NULL +-7.40287e18 c779664c54f557edbb5360386ff7d8b4 +SELECT t1_TEXT, MD5(t1_TEXT) FROM t1 ORDER BY t1_TEXT; +t1_TEXT MD5(t1_TEXT) + d41d8cd98f00b204e9800998ecf8427e +bbbbbbbbbb 82136b4240d6ce4ea7d03e51469a393b +SELECT t1_CHAR_1, MD5(t1_CHAR_1) FROM t1 ORDER BY t1_CHAR_1; +t1_CHAR_1 MD5(t1_CHAR_1) + d41d8cd98f00b204e9800998ecf8427e +b 92eb5ffee6ae2fec3ad71c777531578f +SELECT t1_DATETIME, MD5(t1_DATETIME) FROM t1 ORDER BY t1_DATETIME; +t1_DATETIME MD5(t1_DATETIME) +1990-10-01 00:00:00 626bab9c604a72a1959951119b91c8b2 +2387-11-08 11:22:30 9cf01b3f830ff29aa3f394fd54ea5a23 +SELECT t1_DATETIME FROM t1 WHERE MD5(t1_DATETIME) <> 0 ORDER BY t1_DATETIME; +t1_DATETIME +1990-10-01 00:00:00 +2387-11-08 11:22:30 +DROP DATABASE mcs218_db; diff --git a/mysql-test/suite/tianmu/r/min_function.result b/mysql-test/suite/tianmu/r/min_function.result new file mode 100644 index 000000000..e8704c38d --- /dev/null +++ b/mysql-test/suite/tianmu/r/min_function.result @@ -0,0 +1,26 @@ +# +# Test MIN as distributed aggregate function +# Author: syw +# +DROP DATABASE IF EXISTS mcs191_db; +CREATE DATABASE mcs191_db; +USE mcs191_db; +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +SELECT MIN(DISTINCT a) FROM t1; +MIN(DISTINCT a) +1 +SELECT MIN(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +MIN(DISTINCT a) +1 +SELECT b, MIN(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +b MIN(DISTINCT a) +eee 7 +ddd 4 +ccc 1 +aaa 1 + NULL +SELECT MIN(a) FROM t1; +MIN(a) +1 +DROP DATABASE mcs191_db; diff --git a/mysql-test/suite/tianmu/r/sum_function.result b/mysql-test/suite/tianmu/r/sum_function.result new file mode 100644 index 000000000..34cd2d9f4 --- /dev/null +++ b/mysql-test/suite/tianmu/r/sum_function.result @@ -0,0 +1,26 @@ +# +# Test SUM as distributed aggregate function +# Author: syw +# +DROP DATABASE IF EXISTS mcs189_db; +CREATE DATABASE mcs189_db; +USE mcs189_db; +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +SELECT SUM(DISTINCT a) FROM t1; +SUM(DISTINCT a) +25 +SELECT SUM(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +SUM(DISTINCT a) +8 +SELECT b, SUM(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +b SUM(DISTINCT a) +eee 7 +ddd 10 +ccc 1 +aaa 8 + NULL +SELECT SUM(a) FROM t1; +SUM(a) +26 +DROP DATABASE mcs189_db; diff --git a/mysql-test/suite/tianmu/t/avg_function.test b/mysql-test/suite/tianmu/t/avg_function.test new file mode 100644 index 000000000..5648004b1 --- /dev/null +++ b/mysql-test/suite/tianmu/t/avg_function.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test AVG as distributed aggregate function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs188_db; +--enable_warnings + +CREATE DATABASE mcs188_db; +USE mcs188_db; + +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); + +SELECT AVG(DISTINCT a) FROM t1; +SELECT AVG(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +SELECT b, AVG(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +SELECT AVG(a) FROM t1; + +# Clean UP +DROP DATABASE mcs188_db; diff --git a/mysql-test/suite/tianmu/t/dayname_function.test b/mysql-test/suite/tianmu/t/dayname_function.test new file mode 100644 index 000000000..5e9fc815f --- /dev/null +++ b/mysql-test/suite/tianmu/t/dayname_function.test @@ -0,0 +1,26 @@ +--echo # +--echo # Test DAYNAME function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs185_db; +--enable_warnings + +CREATE DATABASE mcs185_db; +USE mcs185_db; + +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-10-10 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; + +SELECT DAYNAME('1212-12-12 11:11:11'); +SELECT DAYNAME('2020-12-22'); + +SELECT a, DAYNAME(a) FROM t1 ORDER BY 1; +SELECT b, DAYNAME(b) FROM t1 ORDER BY 1; + +# Clean UP +DROP DATABASE mcs185_db; diff --git a/mysql-test/suite/tianmu/t/dayofmonth_function.test b/mysql-test/suite/tianmu/t/dayofmonth_function.test new file mode 100644 index 000000000..ff951fbed --- /dev/null +++ b/mysql-test/suite/tianmu/t/dayofmonth_function.test @@ -0,0 +1,26 @@ +--echo # +--echo # Test DAYOFMONTH function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs187_db; +--enable_warnings + +CREATE DATABASE mcs187_db; +USE mcs187_db; + +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-01-01 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; + +SELECT DAYOFMONTH('1212-12-12 11:11:11'); +SELECT DAYOFMONTH('2020-12-22'); + +SELECT a, DAYOFMONTH(a) FROM t1 ORDER BY 1; +SELECT b, DAYOFMONTH(b) FROM t1 ORDER BY 1; + +# Clean UP +DROP DATABASE mcs187_db; diff --git a/mysql-test/suite/tianmu/t/dayofyear_function.test b/mysql-test/suite/tianmu/t/dayofyear_function.test new file mode 100644 index 000000000..e1d6ed48a --- /dev/null +++ b/mysql-test/suite/tianmu/t/dayofyear_function.test @@ -0,0 +1,26 @@ +--echo # +--echo # Test DAYOFYEAR function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs186_db; +--enable_warnings + +CREATE DATABASE mcs186_db; +USE mcs186_db; + +CREATE TABLE t1 (a DATE, b DATETIME)engine=tianmu; +INSERT INTO t1 VALUES ('1990-10-10', '1990-10-10 0:0:0'), ('1212-12-12', '1212-12-11 11:11:11'), ('3333-03-03', '3333-3-4 3:33:33'); +SHOW CREATE TABLE t1; + +SELECT DAYOFYEAR('1212-12-12 11:11:11'); +SELECT DAYOFYEAR('2020-12-22'); + +SELECT a, DAYOFYEAR(a) FROM t1 ORDER BY 1; +SELECT b, DAYOFYEAR(b) FROM t1 ORDER BY 1; + +# Clean UP +DROP DATABASE mcs186_db; diff --git a/mysql-test/suite/tianmu/t/max_function.test b/mysql-test/suite/tianmu/t/max_function.test new file mode 100644 index 000000000..d8c7c500c --- /dev/null +++ b/mysql-test/suite/tianmu/t/max_function.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test MAX as distributed aggregate function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs190_db; +--enable_warnings + +CREATE DATABASE mcs190_db; +USE mcs190_db; + +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); + +SELECT MAX(DISTINCT a) FROM t1; +SELECT MAX(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +SELECT b, MAX(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +SELECT MAX(a) FROM t1; + +# Clean UP +DROP DATABASE mcs190_db; diff --git a/mysql-test/suite/tianmu/t/md5_function.test b/mysql-test/suite/tianmu/t/md5_function.test new file mode 100644 index 000000000..2829ccba2 --- /dev/null +++ b/mysql-test/suite/tianmu/t/md5_function.test @@ -0,0 +1,38 @@ +--echo # +--echo # Test MD5() function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs218_db; +--enable_warnings + +CREATE DATABASE mcs218_db; +USE mcs218_db; + +CREATE TABLE t1 +( + t1_BIGINT BIGINT, + t1_DOUBLE DOUBLE, + t1_FLOAT FLOAT, + t1_BLOB BLOB, + t1_TEXT TEXT, + t1_CHAR_1 CHAR(1), + t1_DATETIME DATETIME + )ENGINE=tianmu; + +INSERT INTO t1 VALUES(NULL, NULL, NULL, '', '', '', '1990-10-01'); +INSERT INTO t1 VALUES(203685477580676, -3.797693231E+108, -7.402866E+18, repeat('b',10), repeat('b',10), 'b', '2387-11-08 11:22:30.123'); + +SELECT t1_BIGINT, MD5(t1_BIGINT) FROM t1 ORDER BY t1_BIGINT; +SELECT t1_DOUBLE, MD5(t1_DOUBLE) FROM t1 ORDER BY t1_DOUBLE; +SELECT t1_FLOAT, MD5(t1_FLOAT) FROM t1 ORDER BY t1_FLOAT; +SELECT t1_TEXT, MD5(t1_TEXT) FROM t1 ORDER BY t1_TEXT; +SELECT t1_CHAR_1, MD5(t1_CHAR_1) FROM t1 ORDER BY t1_CHAR_1; +SELECT t1_DATETIME, MD5(t1_DATETIME) FROM t1 ORDER BY t1_DATETIME; +SELECT t1_DATETIME FROM t1 WHERE MD5(t1_DATETIME) <> 0 ORDER BY t1_DATETIME; + +# Clean UP +DROP DATABASE mcs218_db; diff --git a/mysql-test/suite/tianmu/t/min_function.test b/mysql-test/suite/tianmu/t/min_function.test new file mode 100644 index 000000000..9eb4e789a --- /dev/null +++ b/mysql-test/suite/tianmu/t/min_function.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test MIN as distributed aggregate function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs191_db; +--enable_warnings + +CREATE DATABASE mcs191_db; +USE mcs191_db; + +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); + +SELECT MIN(DISTINCT a) FROM t1; +SELECT MIN(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +SELECT b, MIN(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +SELECT MIN(a) FROM t1; + +# Clean UP +DROP DATABASE mcs191_db; diff --git a/mysql-test/suite/tianmu/t/sum_function.test b/mysql-test/suite/tianmu/t/sum_function.test new file mode 100644 index 000000000..9c9faa1c1 --- /dev/null +++ b/mysql-test/suite/tianmu/t/sum_function.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test SUM as distributed aggregate function +--echo # Author: syw +--echo # + +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcs189_db; +--enable_warnings + +CREATE DATABASE mcs189_db; +USE mcs189_db; + +CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=tianmu; +INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); + +SELECT SUM(DISTINCT a) FROM t1; +SELECT SUM(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa'; +SELECT b, SUM(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC; +SELECT SUM(a) FROM t1; + +# Clean UP +DROP DATABASE mcs189_db;