未验证 提交 1e42bf61 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #17591 from taosdata/test/TD-19596

Test/td 19596
......@@ -43,7 +43,13 @@ class TDTestCase:
f'today(),3,3.333,333.333333,now()',
f'today()-1d,10,11.11,99.999999,now()',
f'today()+1d,1,1.55,100.555555,today()']
self.db_percision = ['ms','us','ns']
self.rest_tag = str(conn).lower().split('.')[0].replace("<taos","")
if self.rest_tag != 'rest':
self.db_percision = ['ms','us','ns']
else:
self.db_percision = ['ms','us']
def set_create_normaltable_sql(self, ntbname, column_dict):
column_sql = ''
for k, v in column_dict.items():
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
###################################################################
# 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 -*-
from util.cases import tdCases
from .nestedQuery import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime = time.time()
#self.function_before_26()
# self.math_nest(['UNIQUE'])
# self.math_nest(['MODE'])
# self.math_nest(['SAMPLE'])
self.math_nest(['ABS','SQRT'])
self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
self.math_nest(['POW','LOG'])
self.math_nest(['FLOOR','CEIL','ROUND'])
self.math_nest(['MAVG'])
self.math_nest(['HYPERLOGLOG'])
self.math_nest(['TAIL'])
self.math_nest(['CSUM'])
self.math_nest(['statecount','stateduration'])
self.math_nest(['HISTOGRAM'])
# self.str_nest(['LTRIM','RTRIM','LOWER','UPPER'])
# self.str_nest(['LENGTH','CHAR_LENGTH'])
# self.str_nest(['SUBSTR'])
# self.str_nest(['CONCAT'])
# self.str_nest(['CONCAT_WS'])
# self.time_nest(['CAST']) #放到time里起来弄
# self.time_nest(['CAST_1'])
# self.time_nest(['CAST_2'])
# self.time_nest(['CAST_3'])
# self.time_nest(['CAST_4'])
# self.time_nest(['NOW','TODAY'])
# self.time_nest(['TIMEZONE'])
# self.time_nest(['TIMETRUNCATE'])
# self.time_nest(['TO_ISO8601'])
# self.time_nest(['TO_UNIXTIMESTAMP'])
# self.time_nest(['ELAPSED'])
# self.time_nest(['TIMEDIFF_1'])
# self.time_nest(['TIMEDIFF_2'])
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
因为 它太大了无法显示 source diff 。你可以改为 查看blob
###################################################################
# 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 -*-
from util.cases import tdCases
from .nestedQuery import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime = time.time()
# self.function_before_26()
# self.math_nest(['UNIQUE'])
# self.math_nest(['MODE'])
# self.math_nest(['SAMPLE'])
# self.math_nest(['ABS','SQRT'])
# self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
# self.math_nest(['POW','LOG'])
# self.math_nest(['FLOOR','CEIL','ROUND'])
# self.math_nest(['MAVG'])
# self.math_nest(['HYPERLOGLOG'])
# self.math_nest(['TAIL'])
# self.math_nest(['CSUM'])
# self.math_nest(['statecount','stateduration'])
# self.math_nest(['HISTOGRAM'])
# self.str_nest(['LTRIM','RTRIM','LOWER','UPPER'])
# self.str_nest(['LENGTH','CHAR_LENGTH'])
# self.str_nest(['SUBSTR'])
# self.str_nest(['CONCAT'])
# self.str_nest(['CONCAT_WS'])
# self.time_nest(['CAST']) #放到time里起来弄
# self.time_nest(['CAST_1'])
# self.time_nest(['CAST_2'])
# self.time_nest(['CAST_3'])
# self.time_nest(['CAST_4'])
self.time_nest(['NOW','TODAY'])
self.time_nest(['TIMEZONE'])
self.time_nest(['TIMETRUNCATE'])
self.time_nest(['TO_ISO8601'])
self.time_nest(['TO_UNIXTIMESTAMP'])
self.time_nest(['ELAPSED'])
#self.time_nest(['TIMEDIFF_1'])
#self.time_nest(['TIMEDIFF_2'])
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -39,7 +39,7 @@ class TDTestCase:
self.num = 10
self.fornum = 5
self.db_nest = "nest"
self.db_nest = "stab"
self.dropandcreateDB_random("%s" %self.db_nest, 1)
# regular column select
......@@ -780,7 +780,7 @@ class TDTestCase:
print("==========%s===start=============" %mathlist)
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.dropandcreateDB_random("%s" %self.db_nest, 1)
#self.dropandcreateDB_random("%s" %self.db_nest, 1)
if (mathlist == ['ABS','SQRT']) or (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['FLOOR','CEIL','ROUND']) \
or (mathlist == ['CSUM']) :
......@@ -842,7 +842,7 @@ class TDTestCase:
elif (mathlist == ['POW','LOG']) or (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) :
math_functions = mathlist
num = random.randint(0, 1000)
num = random.randint(1, 1000)
fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)',
'(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)']
fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
......@@ -1470,7 +1470,7 @@ class TDTestCase:
print("==========%s===start=============" %strlist)
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.dropandcreateDB_random("%s" %self.db_nest, 1)
#self.dropandcreateDB_random("%s" %self.db_nest, 1)
if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['LENGTH','CHAR_LENGTH']) \
or (strlist == ['']):
......@@ -2206,7 +2206,7 @@ class TDTestCase:
print("==========%s===start=============" %timelist)
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.dropandcreateDB_random("%s" %self.db_nest, 1)
#self.dropandcreateDB_random("%s" %self.db_nest, 1)
if (timelist == ['NOW','TODAY']) or (timelist == ['TIMEZONE']):
time_functions = timelist
......@@ -4881,7 +4881,9 @@ class TDTestCase:
startTime = time.time()
self.function_before_26()
#self.function_before_26()
self.dropandcreateDB_random("%s" %self.db_nest, 1)
self.math_nest(['UNIQUE'])
self.math_nest(['MODE'])
......
###################################################################
# 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 -*-
from util.cases import tdCases
from .stablity import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime = time.time()
self.function_before_26()
self.dropandcreateDB_random("%s" %self.db_nest, 1)
# self.math_nest(['UNIQUE'])
# self.math_nest(['MODE'])
# self.math_nest(['SAMPLE'])
# self.math_nest(['ABS','SQRT'])
# self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
# self.math_nest(['POW','LOG'])
# self.math_nest(['FLOOR','CEIL','ROUND'])
# self.math_nest(['MAVG'])
# self.math_nest(['HYPERLOGLOG'])
# self.math_nest(['TAIL'])
# self.math_nest(['CSUM'])
# self.math_nest(['statecount','stateduration'])
# self.math_nest(['HISTOGRAM'])
self.str_nest(['LTRIM','RTRIM','LOWER','UPPER'])
self.str_nest(['LENGTH','CHAR_LENGTH'])
self.str_nest(['SUBSTR'])
self.str_nest(['CONCAT'])
self.str_nest(['CONCAT_WS'])
self.time_nest(['CAST'])
self.time_nest(['CAST_1'])
self.time_nest(['CAST_2'])
self.time_nest(['CAST_3'])
self.time_nest(['CAST_4'])
self.time_nest(['NOW','TODAY'])
self.time_nest(['TIMEZONE'])
self.time_nest(['TIMETRUNCATE'])
self.time_nest(['TO_ISO8601'])
self.time_nest(['TO_UNIXTIMESTAMP'])
self.time_nest(['ELAPSED'])
self.time_nest(['TIMEDIFF_1'])
self.time_nest(['TIMEDIFF_2'])
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -10,6 +10,9 @@ class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
print(conn)
self.rest_tag = str(conn).lower().split('.')[0].replace("<taos","")
print(self.rest_tag)
self.get_time = GetTime()
self.ts_str = [
'2020-1-1',
......@@ -85,28 +88,36 @@ class TDTestCase:
def check_ns_timestamp(self,unit,date_time):
if unit.lower() == '1b':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]))
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]))
elif unit.lower() == '1u':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000)*1000)
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000)*1000)
elif unit.lower() == '1a':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000)*1000*1000)
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000)*1000*1000)
elif unit.lower() == '1s':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000)*1000*1000*1000)
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000)*1000*1000*1000)
elif unit.lower() == '1m':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60)*60*1000*1000*1000)
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60)*60*1000*1000*1000)
elif unit.lower() == '1h':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60)*60*60*1000*1000*1000 )
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60)*60*60*1000*1000*1000 )
elif unit.lower() == '1d':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24)*24*60*60*1000*1000*1000 )
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24)*24*60*60*1000*1000*1000 )
elif unit.lower() == '1w':
for i in range(len(self.ts_str)):
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24/7)*7*24*60*60*1000*1000*1000)
if self.rest_tag != 'rest':
tdSql.checkEqual(tdSql.queryResult[i][0],int(date_time[i]*1000/1000/1000/1000/1000/60/60/24/7)*7*24*60*60*1000*1000*1000)
def check_tb_type(self,unit,tb_type):
if tb_type.lower() == 'ntb':
......
......@@ -179,7 +179,7 @@ python3 ./test.py -f 2-query/tan.py -R
python3 ./test.py -f 2-query/Timediff.py
python3 ./test.py -f 2-query/Timediff.py -R
python3 ./test.py -f 2-query/timetruncate.py
# python3 ./test.py -f 2-query/timetruncate.py -R
python3 ./test.py -f 2-query/timetruncate.py -R
python3 ./test.py -f 2-query/timezone.py
python3 ./test.py -f 2-query/timezone.py -R
python3 ./test.py -f 2-query/To_iso8601.py
......@@ -187,7 +187,7 @@ python3 ./test.py -f 2-query/To_iso8601.py -R
python3 ./test.py -f 2-query/To_unixtimestamp.py
python3 ./test.py -f 2-query/To_unixtimestamp.py -R
python3 ./test.py -f 2-query/Today.py
# python3 ./test.py -f 2-query/Today.py -R
python3 ./test.py -f 2-query/Today.py -R
python3 ./test.py -f 2-query/top.py
python3 ./test.py -f 2-query/top.py -R
python3 ./test.py -f 2-query/tsbsQuery.py
......@@ -217,11 +217,12 @@ python3 ./test.py -f 2-query/concat2.py
python3 ./test.py -f 2-query/json_tag.py
# python3 ./test.py -f 2-query/nestedQuery.py
# TD-15983 subquery output duplicate name column.
# Please Xiangyang Guo modify the following script
# python3 ./test.py -f 2-query/nestedQuery_str.py
python3 ./test.py -f 2-query/nestedQuery.py
python3 ./test.py -f 2-query/nestedQuery_str.py
python3 ./test.py -f 2-query/nestedQuery_math.py
python3 ./test.py -f 2-query/nestedQuery_time.py
python3 ./test.py -f 2-query/stablity.py
python3 ./test.py -f 2-query/stablity_1.py
python3 ./test.py -f 2-query/elapsed.py
python3 ./test.py -f 2-query/csum.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册