From c1dee7f8811b91231bc03a62f7349a3f74105d99 Mon Sep 17 00:00:00 2001 From: Yang Zhao Date: Mon, 14 Mar 2022 15:42:56 +0800 Subject: [PATCH] [TD-13928]improve user experience for taosbenchmark (#10737) --- src/kit/taos-tools | 2 +- .../taosbenchmark/custom_col_tag.py | 65 +++++++++++ .../taosbenchmark/insert_alltypes_json.py | 104 ++++++++++++++++++ .../taosbenchmark/json/custom_col_tag.json | 91 +++++++++++++++ .../json/stmt_insert_alltypes.json | 13 ++- .../json/taosc_insert_alltypes.json | 12 +- tests/parallel_test/cases.task | 3 +- 7 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py create mode 100644 tests/develop-test/5-taos-tools/taosbenchmark/json/custom_col_tag.json diff --git a/src/kit/taos-tools b/src/kit/taos-tools index f36b07f710..60dfe16d5c 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit f36b07f710d661dca88fdd70e73b5e3e16a960e0 +Subproject commit 60dfe16d5c2b9f612c2f67d7eae05ecec2db216c diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py b/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py new file mode 100644 index 0000000000..f6d52df803 --- /dev/null +++ b/tests/develop-test/5-taos-tools/taosbenchmark/custom_col_tag.py @@ -0,0 +1,65 @@ +################################################################### +# 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 os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + ''' + [TD-13928] taosBenchmark improve user interface + ''' + return + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/custom_col_tag.json" + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkData(0, 0, "ts") + tdSql.checkData(1, 0, "first") + tdSql.checkData(2, 0, "second") + tdSql.checkData(3, 0, "second_1") + tdSql.checkData(4, 0, "second_2") + tdSql.checkData(5, 0, "second_3") + tdSql.checkData(6, 0, "second_4") + tdSql.checkData(7, 0, "third") + tdSql.checkData(8, 0, "forth") + tdSql.checkData(9, 0, "forth_1") + tdSql.checkData(10, 0, "forth_2") + tdSql.checkData(11, 0, "single") + tdSql.checkData(12, 0, "multiple") + tdSql.checkData(13, 0, "multiple_1") + tdSql.checkData(14, 0, "multiple_2") + tdSql.checkData(15, 0, "multiple_3") + tdSql.checkData(16, 0, "multiple_4") + tdSql.checkData(17, 0, "thensingle") + tdSql.checkData(18, 0, "thenmultiple") + tdSql.checkData(19, 0, "thenmultiple_1") + tdSql.checkData(20, 0, "thenmultiple_2") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py index 0b8dd11acc..490d83967e 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/insert_alltypes_json.py @@ -70,6 +70,58 @@ class TDTestCase: tdSql.checkData(27, 1, "SMALLINT UNSIGNED") tdSql.checkData(28, 1, "BINARY") tdSql.checkData(28, 2, 19) + tdSql.query("select count(*) from db.stb where c0 >= 0 and c0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c1 >= 0 and c1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c2 >= 0 and c2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c3 >= 0 and c3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c4 >= 0 and c4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c5 >= 0 and c5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c6 >= 0 and c6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c8 = 'd1' or c8 = 'd2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c9 >= 0 and c9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c10 >= 0 and c10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c11 >= 0 and c11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c12 >= 0 and c12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c13 = 'b1' or c13 = 'b2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t0 >= 0 and t0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t1 >= 0 and t1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t2 >= 0 and t2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t3 >= 0 and t3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t4 >= 0 and t4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t5 >= 0 and t5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t6 >= 0 and t6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t8 = 'd1' or t8 = 'd2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t9 >= 0 and t9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t10 >= 0 and t10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t11 >= 0 and t11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t12 >= 0 and t12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t13 = 'b1' or t13 = 'b2'") + tdSql.checkData(0, 0, 160) cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_insert_alltypes.json" tdLog.info("%s" % cmd) @@ -192,6 +244,58 @@ class TDTestCase: tdSql.checkData(27, 1, "SMALLINT UNSIGNED") tdSql.checkData(28, 1, "BINARY") tdSql.checkData(28, 2, 19) + tdSql.query("select count(*) from db.stb where c0 >= 0 and c0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c1 >= 0 and c1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c2 >= 0 and c2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c3 >= 0 and c3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c4 >= 0 and c4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c5 >= 0 and c5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c6 >= 0 and c6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c8 like 'd1%' or c8 like 'd2%'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c9 >= 0 and c9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c10 >= 0 and c10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c11 >= 0 and c11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c12 >= 0 and c12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c13 like 'b1%' or c13 like 'b2%'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t0 >= 0 and t0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t1 >= 0 and t1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t2 >= 0 and t2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t3 >= 0 and t3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t4 >= 0 and t4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t5 >= 0 and t5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t6 >= 0 and t6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t8 like 'd1%' or t8 like 'd2%'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t9 >= 0 and t9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t10 >= 0 and t10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t11 >= 0 and t11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t12 >= 0 and t12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t13 like 'b1%' or t13 like 'b2%'") + tdSql.checkData(0, 0, 160) def stop(self): diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/custom_col_tag.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/custom_col_tag.json new file mode 100644 index 0000000000..60f1c01461 --- /dev/null +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/custom_col_tag.json @@ -0,0 +1,91 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 1 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": -10, + "childtable_offset": 10, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 0, + "columns": [{ + "type": "INT", + "name": "first" + }, { + "type": "UINT", + "name": "second", + "count": 5 + },{ + "type": "double", + "name": "third" + },{ + "type": "float", + "name": "forth", + "count": 3 + }], + "tags": [{ + "type": "INT", + "name": "single" + }, { + "type": "UINT", + "name": "multiple", + "count": 5 + },{ + "type": "double", + "name": "thensingle" + },{ + "type": "float", + "name": "thenmultiple", + "count": 3 + }] + }] + }] +} \ No newline at end of file diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json index 806142bf2a..91e4d40bcd 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json @@ -55,8 +55,17 @@ "sample_file": "./sample.csv", "use_sample_ts": "no", "tags_file": "", - "columns": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], - "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 29, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 23, "count":1, + "values": ["b1","b2"] + }], + "tags": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 17, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 19, "count":1, + "values": ["b1","b2"] + }] }] }] } diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json index 6816ef5c3d..47eee39193 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json @@ -56,8 +56,16 @@ "use_sample_ts": "no", "tags_file": "", "partial_col_num": 999, - "columns": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], - "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 29, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 23, "count":1, + "values": ["b1","b2"] + }], + "tags": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 17, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 19, "count":1, + "values": ["b1","b2"] + }] }] }] } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index eb84804860..4f6786aadf 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -530,7 +530,8 @@ 10,,pytest,python3 test.py -f client/client.py 9,,script,./test.sh -f general/parser/alter1.sim 9,,script,./test.sh -f general/db/delete.sim -9,,pytest,python3 test.py -f tools/taosdemoTestLimitOffset.py +9,,pytest,python3 test.py -f tools/taosdemoTestLimitOffset.py +9,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py 9,,pytest,python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py 9,,pytest,python3 test.py -f stream/showStreamExecTimeisNull.py 9,,pytest,python3 test.py -f query/bug1876.py -- GitLab