TDengine/tests/pytest/functions/function_count_last_stab.py

71 lines
2.5 KiB
Python
Raw Normal View History

Hotfix/sangshuduo/td 3968 taosdemo datalen 16k (#5930) * [TD-3414]<test>: add insert function with json files of taodemo-testcase -repeat * [TD-3879]add stmt mode for taodemo go * [TD-3414]<test>: add insert function with json files of taodemo-testcase * [TD-3918] <test> add case to verify the bug of TD-3897 * [TD-3453]<test>:modify filepath in scripts * Update fulltest.sh * [TD-3918] <test> fix the case * Update queryFilterTswithDateUnit.py * [TD-3850]<fix>: fix vnode write enqueue flowctrl UAF & no response * Hotfix/sangshuduo/td 3401 query statistic (#5907) * [TD-3401]<fix>: taosdemo query statistic. refactor func name. * [TD-3401]<fix>: taosdemo query statistic. refactor func name 2. * [TD-3401]<fix>: taosdemo support query statistic. implementation. * cleanup * [TD-3401]<fix>: taosdemo query statistic. change us to ms. * [TD-3401]<fix>: taosdemo query statistic. increase sql buffer for query. * [TD-3401]<fix>: taosdemo query statistic more accurate result. * [TD-3401]<fix>: taosdemo query statistic. modify last time logic. Co-authored-by: Shuduo Sang <sdsang@taosdata.com> * improve coverage of operations * [TD-3944]<fix>: make default offline threshold to 10 days. (#5912) Co-authored-by: Shuduo Sang <sdsang@taosdata.com> * [TD-3572]<enhance>: response out of dnodes if #dnodes <= maxDbReplica * [TD-3937]<test>: add taosdemo performance test compare scripts * update script * Hotfix/sangshuduo/td 3317 for master (#5921) * [TD-3317]<fix>: taosdemo interlace insertion. patch for master. * [TD-3317]<fix>: taosdemo support interlace mode. adjust remainder rows logic. * [TD-3317]<fix>: taosdemo support interlace mode. fix global and stable interlace rows logic. * [TD-3317]<fix>: taosdemo support interlace mode. fix 'interlaceRows' is used uninitialized Co-authored-by: Shuduo Sang <sdsang@taosdata.com> * [TD-3968]<fix>: taosdemo data length should be 16*1024 Co-authored-by: tomchon <haoran920c@163.com> Co-authored-by: liuyq-617 <yqliu@taosdata.com> Co-authored-by: wu champion <wuchampion@foxmail.com> Co-authored-by: wu champion <cpwu@taosdata.com> Co-authored-by: Minglei Jin <mljin@taosdata.com> Co-authored-by: huili <52318143+plum-lihui@users.noreply.github.com> Co-authored-by: Shengliang Guan <slguan@taosdata.com> Co-authored-by: Shuduo Sang <sdsang@taosdata.com> Co-authored-by: Ping Xiao <pxiao@taosdata.com>
2021-04-26 10:48:52 +00:00
###################################################################
# 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 *
from util.cases import *
from util.sql import *
import numpy as np
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.rowNum = 10
self.ts = 1537146000000
def run(self):
tdSql.prepare()
tdSql.execute('''create stable stest(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
tdSql.execute("create table test1 using stest tags('beijing')")
tdSql.execute("insert into test1(ts) values(%d)" % (self.ts - 1))
# last verifacation
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i, i + 1, 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.query("select count(*),last(*) from stest group by col1")
tdSql.checkRows(10)
tdSql.checkData(0, 0, 1)
tdSql.checkData(1, 2, 2)
tdSql.checkData(1, 3, 1)
tdSql.query("select count(*),last(*) from stest group by col2")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 10)
tdSql.checkData(0, 2, 10)
tdSql.checkData(0, 3, 1)
tdSql.query("select count(*),last(ts,stest.*) from stest group by col1")
tdSql.checkRows(10)
tdSql.checkData(0, 0, 1)
tdSql.checkData(0, 2, "2018-09-17 09:00:00")
tdSql.checkData(1, 4, 1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())