diff --git a/tests/system-test/2-query/countAlwaysReturnValue.py b/tests/system-test/2-query/countAlwaysReturnValue.py new file mode 100644 index 0000000000000000000000000000000000000000..25eae49516035b0aa97dc503ae2c911236739590 --- /dev/null +++ b/tests/system-test/2-query/countAlwaysReturnValue.py @@ -0,0 +1,125 @@ +import taos +import sys +import datetime +import inspect + +from util.log import * +from util.sql import * +from util.cases import * +import random + + +class TDTestCase: + updatecfgDict = {"countAlwaysReturnValue":0} + + def init(self, conn, logSql, replicaVar=1): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepare_data(self, dbname="db"): + tdSql.execute( + f"create database if not exists {dbname} keep 3650 duration 1000") + tdSql.execute(f"use {dbname} ") + tdSql.execute( + f"create table {dbname}.tb (ts timestamp, c0 int)" + ) + tdSql.execute( + f"create table {dbname}.stb (ts timestamp, c0 int) tags (t0 int)" + ) + tdSql.execute( + f"create table {dbname}.ctb1 using {dbname}.stb tags (1)" + ) + tdSql.execute( + f"create table {dbname}.ctb2 using {dbname}.stb tags (2)" + ) + + tdSql.execute( + f"insert into {dbname}.tb values (now(), NULL)") + + tdSql.execute( + f"insert into {dbname}.ctb1 values (now(), NULL)") + + tdSql.execute( + f"insert into {dbname}.ctb2 values (now() + 1s, NULL)") + + def test_results(self, dbname="db"): + + # count + tdSql.query(f"select count(c0) from {dbname}.tb") + tdSql.checkRows(0) + + tdSql.query(f"select count(NULL) from {dbname}.tb") + tdSql.checkRows(0) + + tdSql.query(f"select c0,count(c0) from {dbname}.tb group by c0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query(f"select count(c0) from {dbname}.stb") + tdSql.checkRows(0) + + tdSql.query(f"select count(NULL) from {dbname}.stb") + tdSql.checkRows(0) + + tdSql.query(f"select c0,count(c0) from {dbname}.stb group by c0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query(f"select tbname,count(c0) from {dbname}.stb partition by tbname") + tdSql.checkRows(2) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, None) + + tdSql.query(f"select count(NULL)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + # hyperloglog + tdSql.query(f"select hyperloglog(c0) from {dbname}.tb") + tdSql.checkRows(0) + + tdSql.query(f"select hyperloglog(NULL) from {dbname}.tb") + tdSql.checkRows(0) + + tdSql.query(f"select c0,hyperloglog(c0) from {dbname}.tb group by c0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query(f"select hyperloglog(c0) from {dbname}.stb") + tdSql.checkRows(0) + + tdSql.query(f"select hyperloglog(NULL) from {dbname}.stb") + tdSql.checkRows(0) + + tdSql.query(f"select c0,hyperloglog(c0) from {dbname}.stb group by c0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query(f"select tbname,hyperloglog(c0) from {dbname}.stb partition by tbname") + tdSql.checkRows(2) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, None) + + tdSql.query(f"select hyperloglog(NULL)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + def run(self): + tdSql.prepare() + + tdLog.printNoPrefix("==========step1:prepare data ==============") + + self.prepare_data() + + tdLog.printNoPrefix("==========step2:test results ==============") + + self.test_results() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/hyperloglog.py b/tests/system-test/2-query/hyperloglog.py index eff687cba71b7adaf415f46e27b5047c13913bbc..a139cc19af885b3b31b45fc3523b14b2183c8837 100644 --- a/tests/system-test/2-query/hyperloglog.py +++ b/tests/system-test/2-query/hyperloglog.py @@ -28,7 +28,7 @@ ALL_COL = [ INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BOOL_C DBNAME = "db" class TDTestCase: - + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql, replicaVar=1): diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index c65c574e7c068fa71f57c372020793c55aca6729..3bbf3096a45494e2fefe161190bfda08fb0c64b9 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -17,7 +17,7 @@ python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3 python3 ./test.py -f 0-others/sysinfo.py python3 ./test.py -f 0-others/user_control.py python3 ./test.py -f 0-others/fsync.py -python3 ./test.py -f 0-others/compatibility.py +python3 ./test.py -f 0-others/compatibility.py python3 ./test.py -f 1-insert/alter_database.py python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py @@ -76,6 +76,8 @@ python3 ./test.py -f 2-query/count_partition.py python3 ./test.py -f 2-query/count_partition.py -R python3 ./test.py -f 2-query/count.py python3 ./test.py -f 2-query/count.py -R +python3 ./test.py -f 2-query/countAlwaysReturnValue.py +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -R python3 ./test.py -f 2-query/db.py python3 ./test.py -f 2-query/db.py -R python3 ./test.py -f 2-query/diff.py @@ -383,6 +385,7 @@ python3 ./test.py -f 2-query/Today.py -Q 2 python3 ./test.py -f 2-query/max.py -Q 2 python3 ./test.py -f 2-query/min.py -Q 2 python3 ./test.py -f 2-query/count.py -Q 2 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 2 python3 ./test.py -f 2-query/last.py -Q 2 python3 ./test.py -f 2-query/first.py -Q 2 python3 ./test.py -f 2-query/To_iso8601.py -Q 2 @@ -478,6 +481,7 @@ python3 ./test.py -f 2-query/Today.py -Q 3 python3 ./test.py -f 2-query/max.py -Q 3 python3 ./test.py -f 2-query/min.py -Q 3 python3 ./test.py -f 2-query/count.py -Q 3 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 3 python3 ./test.py -f 2-query/last.py -Q 3 python3 ./test.py -f 2-query/first.py -Q 3 python3 ./test.py -f 2-query/To_iso8601.py -Q 3 @@ -575,6 +579,7 @@ python3 ./test.py -f 2-query/Today.py -Q 4 python3 ./test.py -f 2-query/max.py -Q 4 python3 ./test.py -f 2-query/min.py -Q 4 python3 ./test.py -f 2-query/count.py -Q 4 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -Q 4 python3 ./test.py -f 2-query/last.py -Q 4 python3 ./test.py -f 2-query/first.py -Q 4 python3 ./test.py -f 2-query/To_iso8601.py -Q 4 @@ -590,7 +595,7 @@ python3 ./test.py -f 2-query/apercentile.py -Q 4 python3 ./test.py -f 2-query/abs.py -Q 4 python3 ./test.py -f 2-query/ceil.py -Q 4 python3 ./test.py -f 2-query/floor.py -Q 4 -python3 ./test.py -f 2-query/round.py -Q 4 +python3 ./test.py -f 2-query/round.py -Q 4 python3 ./test.py -f 2-query/log.py -Q 4 python3 ./test.py -f 2-query/pow.py -Q 4 python3 ./test.py -f 2-query/sqrt.py -Q 4