From 091271b02d739db3c7220e3cc231d1d589a5b647 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 7 Sep 2020 15:12:02 +0800 Subject: [PATCH 1/3] minor changes --- packaging/cfg/taos.cfg | 2 +- src/common/src/tglobal.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index 7be6e72962..c12726d292 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -129,7 +129,7 @@ # mqttPort 1883 # mqtt topic -# mqttTopic /weather/loop +# mqttTopic /test # the compressed rpc message, option: # -1 (no compression) diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index c7763a257a..9683a63503 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -1298,21 +1298,21 @@ bool taosCheckGlobalCfg() { taosGetFqdn(tsLocalFqdn); } - snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%d", tsLocalFqdn, tsServerPort); + snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort); uInfo("localEp is: %s", tsLocalEp); if (tsFirst[0] == 0) { strcpy(tsFirst, tsLocalEp); } else { taosGetFqdnPortFromEp(tsFirst, fqdn, &port); - snprintf(tsFirst, sizeof(tsFirst), "%s:%d", fqdn, port); + snprintf(tsFirst, sizeof(tsFirst), "%s:%u", fqdn, port); } if (tsSecond[0] == 0) { strcpy(tsSecond, tsLocalEp); } else { taosGetFqdnPortFromEp(tsSecond, fqdn, &port); - snprintf(tsSecond, sizeof(tsSecond), "%s:%d", fqdn, port); + snprintf(tsSecond, sizeof(tsSecond), "%s:%u", fqdn, port); } taosGetSystemInfo(); From 7ec52b6bb57ae4ef393029e6755cf58e1175d57b Mon Sep 17 00:00:00 2001 From: root Date: Mon, 7 Sep 2020 15:25:01 +0800 Subject: [PATCH 2/3] update scripts --- tests/script/general/insert/insert_drop.sim | 2 +- tests/script/general/parser/commit.sim | 2 +- tests/script/general/parser/selectResNum.sim | 2 +- tests/script/general/parser/topbot.sim | 2 +- tests/script/general/parser/union.sim | 2 +- tests/script/general/table/limit.sim | 2 +- tests/script/unique/vnode/replica3_vgroup.sim | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/script/general/insert/insert_drop.sim b/tests/script/general/insert/insert_drop.sim index cf29656067..80c16ff8e4 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/general/insert/insert_drop.sim @@ -19,7 +19,7 @@ $stb = stb sql drop database $db -x step1 step1: -sql create database $db maxtables 10 ctime 30 +sql create database $db ctime 30 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int) tags(t1 int) diff --git a/tests/script/general/parser/commit.sim b/tests/script/general/parser/commit.sim index 31f457cfae..547fdaad12 100644 --- a/tests/script/general/parser/commit.sim +++ b/tests/script/general/parser/commit.sim @@ -23,7 +23,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db maxrows 255 maxtables 100 ctime 3600 +sql create database $db maxrows 255 ctime 3600 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) diff --git a/tests/script/general/parser/selectResNum.sim b/tests/script/general/parser/selectResNum.sim index 319e034c0c..63cc486d65 100644 --- a/tests/script/general/parser/selectResNum.sim +++ b/tests/script/general/parser/selectResNum.sim @@ -23,7 +23,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db cache 16 maxtables 200 +sql create database $db cache 16 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) diff --git a/tests/script/general/parser/topbot.sim b/tests/script/general/parser/topbot.sim index 8e529b4eb4..ff4dcb6b3d 100644 --- a/tests/script/general/parser/topbot.sim +++ b/tests/script/general/parser/topbot.sim @@ -23,7 +23,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db cache 16 maxtables 200 +sql create database $db cache 16 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) diff --git a/tests/script/general/parser/union.sim b/tests/script/general/parser/union.sim index fbd1c211b9..a276624491 100644 --- a/tests/script/general/parser/union.sim +++ b/tests/script/general/parser/union.sim @@ -27,7 +27,7 @@ $mt1 = $mtPrefix . $j sql drop database if exits $db -x step1 step1: -sql create database if not exists $db maxtables 4 +sql create database if not exists $db sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int) diff --git a/tests/script/general/table/limit.sim b/tests/script/general/table/limit.sim index 6287807954..18597f2e1c 100644 --- a/tests/script/general/table/limit.sim +++ b/tests/script/general/table/limit.sim @@ -17,7 +17,7 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =================== step 0 -sql create database $db maxtables 129 +sql create database $db sql use $db sql show vgroups if $rows != 0 then diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim index 09ca261a06..11295ba0a4 100644 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ b/tests/script/unique/vnode/replica3_vgroup.sim @@ -26,7 +26,7 @@ sleep 3000 print =================== step 1 -sql create database $db replica 3 maxtables 100 +sql create database $db replica 3 sql use $db sql create table st (ts timestamp, speed int) tags (t1 int) sleep 3001 From 0f7b3ce04052b394d50411fb2ffe7425d4882f15 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 7 Sep 2020 15:50:55 +0800 Subject: [PATCH 3/3] [TD-1290] add test case for group by --- tests/pytest/query/queryGroupbySort.py | 50 ++++++++++++++++++++++++++ tests/pytest/util/sql.py | 4 +-- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 tests/pytest/query/queryGroupbySort.py diff --git a/tests/pytest/query/queryGroupbySort.py b/tests/pytest/query/queryGroupbySort.py new file mode 100644 index 0000000000..28ef897f42 --- /dev/null +++ b/tests/pytest/query/queryGroupbySort.py @@ -0,0 +1,50 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + tdSql.execute( + "create table stb(ts timestamp,i int) tags (p_id nchar(20));") + tdSql.execute( + "insert into tb using stb tags('11231') values (%d, %d) (%d, %d) (%d, %d) (%d, %d)" + % (self.ts, 12, self.ts + 1, 15, self.ts + 2, 15, self.ts + 3, 12)) + + tdSql.query(''' select last(ts) p_time,i from stb where p_id='11231' and ts>=%d and ts <=%d + group by i order by time desc limit 100 ''' % (self.ts, self.ts + 4)) + tdSql.checkRows(2) + tdSql.checkData(0, 0, "2018-09-17 09:00:00.003000") + tdSql.checkData(1, 0, "2018-09-17 09:00:00.002000") + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 1e1d02959f..627d712474 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -122,8 +122,8 @@ class TDSql: return self.cursor.istype(col, dataType) def checkData(self, row, col, data): - self.checkRowCol(row, col) - if self.queryResult[row][col] != data: + self.checkRowCol(row, col) + if str(self.queryResult[row][col]) != str(data): if isinstance(data, float) and abs(self.queryResult[row][col] - data) <= 0.000001: tdLog.info("sql:%s, row:%d col:%d data:%f == expect:%f" % (self.sql, row, col, self.queryResult[row][col], data))