From c0cc64d6c9dd1a042b9b4eb9b9a2b7d0b00e29a2 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 25 Sep 2023 14:27:37 +0800 Subject: [PATCH] test: add insertFromCsvOfLength65500 case for TS-3957 --- .../system-test/1-insert/row64kInsertByCsv.py | 70 +++++++++++++++++++ tests/system-test/1-insert/rowlength64k.py | 13 ---- 2 files changed, 70 insertions(+), 13 deletions(-) create mode 100755 tests/system-test/1-insert/row64kInsertByCsv.py diff --git a/tests/system-test/1-insert/row64kInsertByCsv.py b/tests/system-test/1-insert/row64kInsertByCsv.py new file mode 100755 index 0000000000..2c4458c5dc --- /dev/null +++ b/tests/system-test/1-insert/row64kInsertByCsv.py @@ -0,0 +1,70 @@ +################################################################### +# 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 random +import os +import time +import taos +import subprocess +import string +from faker import Faker +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes +from util.dnodes import * + +class TDTestCase: + updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"querySmaOptimize":1} + + def init(self, conn, logSql, replicaVar): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.testcasePath = os.path.split(__file__)[0] + self.testcasePath = self.testcasePath.replace('\\', '//') + self.testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename)) + + now = time.time() + self.ts = int(round(now * 1000)) + self.num = 100 + + def insertFromCsvOfLength65500(self): + + tdLog.info('test insert from csv of length 65500') + os.system(f"taosBenchmark -f {self.testcasePath}//tableColumn4096.json") + + tdSql.execute(f"insert into db4096.ctb00 file '{self.testcasePath}//tableColumn4096csvLength64k.csv'") + tdSql.query("select count(*) from db4096.ctb00") + tdSql.checkData(0, 0, 1) + tdSql.query("select length(c4092) from db4096.ctb00") + tdSql.checkData(0, 0, 16375) + + + def run(self): + tdSql.prepare() + + startTime_all = time.time() + self.insertFromCsvOfLength65500() + endTime_all = time.time() + print("total time %ds" % (endTime_all - startTime_all)) + + + 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/system-test/1-insert/rowlength64k.py b/tests/system-test/1-insert/rowlength64k.py index 7ba5faf593..1c7c1d831e 100755 --- a/tests/system-test/1-insert/rowlength64k.py +++ b/tests/system-test/1-insert/rowlength64k.py @@ -1264,18 +1264,6 @@ class TDTestCase: self.ins_query() - def insertFromCsvOfLength65500(self): - - tdLog.info('test insert from csv of length 65500') - os.system(f"taosBenchmark -f {self.testcasePath}//tableColumn4096.json") - - tdSql.execute(f"insert into db4096.ctb00 file '{self.testcasePath}//tableColumn4096csvLength64k.csv'") - tdSql.query("select count(*) from db4096.ctb00") - tdSql.checkData(0, 0, 1) - tdSql.query("select length(c4092) from db4096.ctb00") - tdSql.checkData(0, 0, 16375) - - def run(self): tdSql.prepare() @@ -1289,7 +1277,6 @@ class TDTestCase: # self.run_5() # self.run_6() # self.run_7() - self.insertFromCsvOfLength65500() endTime_all = time.time() print("total time %ds" % (endTime_all - startTime_all))