diff --git a/tests/Jenkinsfile b/tests/Jenkinsfile index 0c1f651059..c75427b5f4 100644 --- a/tests/Jenkinsfile +++ b/tests/Jenkinsfile @@ -110,16 +110,8 @@ pipeline { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { sh ''' cd ${WKC}/tests/examples/JDBC/JDBCDemo/ - mvn clean package assembly:single -DskipTests >/dev/null - java -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1 - ''' - } - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh ''' - cd ${WKC}/src/connector/jdbc - mvn clean package -Dmaven.test.skip=true >/dev/null - cd ${WKC}/tests/examples/JDBC/JDBCDemo/ - java --class-path=../../../../src/connector/jdbc/target:$JAVA_HOME/jre/lib/ext -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1 + mvn clean package >/dev/null + java -jar target/JdbcRestfulDemo-jar-with-dependencies.jar ''' } catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { diff --git a/tests/comparisonTest/opentsdb/opentsdbtest/pom.xml b/tests/comparisonTest/opentsdb/opentsdbtest/pom.xml index 0af7491128..e0ada8b763 100644 --- a/tests/comparisonTest/opentsdb/opentsdbtest/pom.xml +++ b/tests/comparisonTest/opentsdb/opentsdbtest/pom.xml @@ -162,7 +162,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.13 @@ -216,13 +216,13 @@ ch.qos.logback logback-core - 1.0.13 + 1.2.0 ch.qos.logback logback-classic - 1.0.13 + 1.2.0 diff --git a/tests/comparisonTest/tdengine/tdengineTest.c b/tests/comparisonTest/tdengine/tdengineTest.c index d1cf3a1f98..0de419e036 100644 --- a/tests/comparisonTest/tdengine/tdengineTest.c +++ b/tests/comparisonTest/tdengine/tdengineTest.c @@ -181,8 +181,8 @@ void writeDataImp(void *param) { if (lastMachineid != machineid) { lastMachineid = machineid; - sqlLen += sprintf(sql + sqlLen, " dev%d using devices tags(%d,'%s',%d) values", - machineid, machineid, machinename, machinegroup); + sqlLen += sprintf(sql + sqlLen, " dev%d values", + machineid); } sqlLen += sprintf(sql + sqlLen, "(%" PRId64 ",%d,%f)", timestamp, temperature, humidity); @@ -192,7 +192,8 @@ void writeDataImp(void *param) { result = taos_query(taos, sql); code = taos_errno(result); if (code != 0) { - printf("thread:%d error:%d reason:%s\n", pThread->threadId, code, taos_errstr(taos)); + printf("insert into dev%d values (%" PRId64 ",%d,%f)\n",machineid, timestamp, temperature, humidity); + printf("thread:%d error:%d reason:%s\n", pThread->threadId, code, taos_errstr(result)); } taos_free_result(result); @@ -210,6 +211,7 @@ void writeDataImp(void *param) { result = taos_query(taos, sql); code = taos_errno(result); if (code != 0) { + // printf("insert into dev%d using devices tags(%d,'%s',%d) values (%" PRId64 ",%d,%f)",machineid, machineid, machinename, machinegroup, timestamp, temperature, humidity); printf("thread:%d error:%d reason:%s\n", pThread->threadId, code, taos_errstr(taos)); } taos_free_result(result); @@ -246,7 +248,7 @@ void writeData() { taos_free_result(result); result = taos_query(taos, - "create table if not exists db.devices(ts timestamp, temperature int, humidity float) " + "create stable if not exists db.devices(ts timestamp, temperature int, humidity float) " "tags(devid int, devname binary(16), devgroup int)"); code = taos_errno(result); if (code != 0) { @@ -254,6 +256,77 @@ void writeData() { } taos_free_result(result); + //create tables before insert the data + result = taos_query(taos, "use db"); + code = taos_errno(result); + if (code != 0) { + taos_error(result, taos); + } + taos_free_result(result); + + char *sql = calloc(1, 8*1024*1024); + int sqlLen = 0; + int lastMachineid = 0; + int counter = 0; + int totalRecords = 0; + for (int i = 0; i < arguments.filesNum; i++) { + char fileName[300]; + sprintf(fileName, "%s/testdata%d.csv", arguments.dataDir, i); + + FILE *fp = fopen(fileName, "r"); + if (fp == NULL) { + printf("failed to open file %s\n", fileName); + exit(1); + } + printf("open file %s success\n", fileName); + + char *line = NULL; + size_t len = 0; + while (!feof(fp)) { + free(line); + line = NULL; + len = 0; + + getline(&line, &len, fp); + if (line == NULL) break; + + if (strlen(line) < 10) continue; + + int machineid; + char machinename[16]; + int machinegroup; + int64_t timestamp; + int temperature; + float humidity; + sscanf(line, "%d%s%d%" PRId64 "%d%f", &machineid, machinename, &machinegroup, ×tamp, &temperature, &humidity); + + if (counter == 0) { + sqlLen = sprintf(sql, "create table if not exists"); + } + + if (lastMachineid != machineid) { + lastMachineid = machineid; + sqlLen += sprintf(sql + sqlLen, " dev%d using devices tags(%d,'%s',%d)", machineid, machineid, machinename, machinegroup); + } + counter++; + + if (counter >= arguments.rowsPerRequest) { + result = taos_query(taos, sql); + code = taos_errno(result); + if (code != 0) { + printf("create table error:%d reason:%s\n", code, taos_errstr(result)); + } + taos_free_result(result); + + totalRecords += counter; + counter = 0; + lastMachineid = -1; + sqlLen = 0; + } + } + fclose(fp); + } + int64_t st = getTimeStampMs(); int a = arguments.filesNum / arguments.clients; @@ -379,5 +452,4 @@ void readData() { } free(threads); -} - +} \ No newline at end of file diff --git a/tests/examples/JDBC/JDBCDemo/pom.xml b/tests/examples/JDBC/JDBCDemo/pom.xml index 66e866a2d3..ca8cd24030 100644 --- a/tests/examples/JDBC/JDBCDemo/pom.xml +++ b/tests/examples/JDBC/JDBCDemo/pom.xml @@ -9,11 +9,15 @@ SNAPSHOT jar + + src/main/resources/assembly + + com.taosdata.jdbc taos-jdbcdriver - 2.0.22 + 2.0.30 @@ -22,20 +26,60 @@ org.apache.maven.plugins maven-assembly-plugin - 3.1.0 - - - - com.taosdata.example.JDBCDemo - - - - jar-with-dependencies - - + 3.3.0 + - make-assembly + JdbcDemo + + JdbcDemo + + + com.taosdata.example.JdbcDemo + + + + jar-with-dependencies + + + package + + single + + + + + JdbcRestfulDemo + + JdbcRestfulDemo + + + com.taosdata.example.JdbcRestfulDemo + + + + jar-with-dependencies + + + package + + single + + + + + SubscribeDemo + + SubscribeDemo + + + com.taosdata.example.SubscribeDemo + + + + jar-with-dependencies + + package single diff --git a/tests/examples/JDBC/JDBCDemo/readme.md b/tests/examples/JDBC/JDBCDemo/readme.md index 9484442085..da638a0bcc 100644 --- a/tests/examples/JDBC/JDBCDemo/readme.md +++ b/tests/examples/JDBC/JDBCDemo/readme.md @@ -11,12 +11,12 @@ Download the tdengine package on our website: ``https://www.taosdata.com/cn/all- ## Run jdbcDemo using mvn plugin run command: ``` -mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo" +mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JdbcDemo" ``` and run with your customed args ``` -mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo" -Dexec.args="-host [HOSTNAME]" +mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JdbcDemo" -Dexec.args="-host [HOSTNAME]" ``` ## Compile the Demo Code and Run It diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java similarity index 98% rename from tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCDemo.java rename to tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java index da865b3ffd..f256668dc6 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCDemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcDemo.java @@ -3,7 +3,7 @@ package com.taosdata.example; import java.sql.*; import java.util.Properties; -public class JDBCDemo { +public class JdbcDemo { private static String host; private static final String dbName = "test"; private static final String tbName = "weather"; @@ -17,7 +17,7 @@ public class JDBCDemo { if (host == null) { printHelp(); } - JDBCDemo demo = new JDBCDemo(); + JdbcDemo demo = new JdbcDemo(); demo.init(); demo.createDatabase(); demo.useDatabase(); diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java index eedb0ba166..5bf980f6d8 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcRestfulDemo.java @@ -4,7 +4,7 @@ import java.sql.*; import java.util.Properties; public class JdbcRestfulDemo { - private static final String host = "master"; + private static final String host = "127.0.0.1"; public static void main(String[] args) { try { diff --git a/tests/examples/JDBC/connectionPools/pom.xml b/tests/examples/JDBC/connectionPools/pom.xml index 84467003f9..045e9d336c 100644 --- a/tests/examples/JDBC/connectionPools/pom.xml +++ b/tests/examples/JDBC/connectionPools/pom.xml @@ -9,12 +9,12 @@ 1.0-SNAPSHOT + com.taosdata.jdbc taos-jdbcdriver 2.0.18 - com.alibaba @@ -50,6 +50,12 @@ log4j 1.2.17 + + + com.cloudhopper.proxool + proxool + 0.9.1 + @@ -57,25 +63,46 @@ org.apache.maven.plugins maven-assembly-plugin - 3.1.0 - - - - com.taosdata.example.ConnectionPoolDemo - - - - jar-with-dependencies - - + 3.3.0 - make-assembly + ConnectionPoolDemo + + ConnectionPoolDemo + + + com.taosdata.example.ConnectionPoolDemo + + + + jar-with-dependencies + + package single + + + ProxoolDemo + + ProxoolDemo + + + com.taosdata.example.ProxoolDemo + + + + jar-with-dependencies + + + package + + single + + + diff --git a/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ProxoolDemo.java b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ProxoolDemo.java new file mode 100644 index 0000000000..632ad8c9bf --- /dev/null +++ b/tests/examples/JDBC/connectionPools/src/main/java/com/taosdata/example/ProxoolDemo.java @@ -0,0 +1,56 @@ +package com.taosdata.example; + +import org.logicalcobwebs.proxool.ProxoolException; +import org.logicalcobwebs.proxool.configuration.JAXPConfigurator; + +import java.sql.*; + +public class ProxoolDemo { + + + public static void main(String[] args) { + + String xml = parseConfigurationXml(args); + if (xml == null) { + printHelp(); + System.exit(0); + } + + try { + JAXPConfigurator.configure(xml, false); + Class.forName("org.logicalcobwebs.proxool.ProxoolDriver"); + Connection connection = DriverManager.getConnection("proxool.ds"); + + Statement stmt = connection.createStatement(); + + ResultSet rs = stmt.executeQuery("show databases"); + ResultSetMetaData metaData = rs.getMetaData(); + while (rs.next()) { + for (int i = 1; i <= metaData.getColumnCount(); i++) { + System.out.print(metaData.getColumnLabel(i) + ": " + rs.getString(i)); + } + System.out.println(); + } + + stmt.close(); + + } catch (ClassNotFoundException | SQLException | ProxoolException e) { + e.printStackTrace(); + } + } + + private static String parseConfigurationXml(String[] args) { + String host = null; + for (int i = 0; i < args.length; i++) { + if ("--xml".equalsIgnoreCase(args[i]) && i < args.length - 1) { + host = args[++i]; + } + } + return host; + } + + private static void printHelp() { + System.out.println("Usage: java -jar ProxoolDemo.jar --xml [xml]"); + } + +} diff --git a/tests/examples/JDBC/connectionPools/src/main/resources/proxool.xml b/tests/examples/JDBC/connectionPools/src/main/resources/proxool.xml new file mode 100644 index 0000000000..67baa1c393 --- /dev/null +++ b/tests/examples/JDBC/connectionPools/src/main/resources/proxool.xml @@ -0,0 +1,27 @@ + + + + ds + + jdbc:TAOS-RS://127.0.0.1:6041/log + + com.taosdata.jdbc.rs.RestfulDriver + + + + + + + 100 + + 100 + + 1 + + 5 + + 30000 + + select server_status() + + \ No newline at end of file diff --git a/tests/examples/c/apitest.c b/tests/examples/c/apitest.c index b2411d1212..0f24df0f47 100644 --- a/tests/examples/c/apitest.c +++ b/tests/examples/c/apitest.c @@ -86,7 +86,7 @@ static int print_result(TAOS_RES* res, int blockFetch) { } } else { while ((row = taos_fetch_row(res))) { - char temp[256]; + char temp[256] = {0}; taos_print_row(temp, row, fields, num_fields); puts(temp); nRows++; @@ -342,7 +342,9 @@ void verify_prepare(TAOS* taos) { sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)"; code = taos_stmt_prepare(stmt, sql, 0); if (code != 0){ - printf("\033[31mfailed to execute taos_stmt_prepare. code:0x%x\033[0m\n", code); + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; } v.ts = 1591060628000; for (int i = 0; i < 10; ++i) { @@ -365,8 +367,8 @@ void verify_prepare(TAOS* taos) { taos_stmt_add_batch(stmt); } if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); taos_stmt_close(stmt); - printf("\033[31mfailed to execute insert statement.\033[0m\n"); return; } taos_stmt_close(stmt); @@ -378,8 +380,8 @@ void verify_prepare(TAOS* taos) { v.v2 = 15; taos_stmt_bind_param(stmt, params + 2); if (taos_stmt_execute(stmt) != 0) { + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); taos_stmt_close(stmt); - printf("\033[31mfailed to execute select statement.\033[0m\n"); return; } @@ -389,10 +391,10 @@ void verify_prepare(TAOS* taos) { int rows = 0; int num_fields = taos_num_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result); - char temp[256]; // fetch the records row by row while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; rows++; taos_print_row(temp, row, fields, num_fields); printf("%s\n", temp); @@ -402,10 +404,6 @@ void verify_prepare(TAOS* taos) { taos_stmt_close(stmt); } - - - - void verify_prepare2(TAOS* taos) { TAOS_RES* result = taos_query(taos, "drop database if exists test;"); taos_free_result(result); @@ -531,16 +529,19 @@ void verify_prepare2(TAOS* taos) { params[9].is_null = is_null; params[9].num = 10; - - sql = "insert into ? values(?,?,?,?,?,?,?,?,?,?)"; + sql = "insert into ? (ts, b, v1, v2, v4, v8, f4, f8, bin, blob) values(?,?,?,?,?,?,?,?,?,?)"; code = taos_stmt_prepare(stmt, sql, 0); - if (code != 0){ - printf("\033[31mfailed to execute taos_stmt_prepare. code:0x%x\033[0m\n", code); + if (code != 0) { + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; } code = taos_stmt_set_tbname(stmt, "m1"); if (code != 0){ - printf("\033[31mfailed to execute taos_stmt_prepare. code:0x%x\033[0m\n", code); + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; } int64_t ts = 1591060628000; @@ -574,13 +575,13 @@ void verify_prepare2(TAOS* taos) { taos_stmt_add_batch(stmt); if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute insert statement.\033[0m\n"); + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); return; } + taos_stmt_close(stmt); - - // query the records stmt = taos_stmt_init(taos); taos_stmt_prepare(stmt, "SELECT * FROM m1 WHERE v1 > ? AND v2 < ?", 0); @@ -602,7 +603,8 @@ void verify_prepare2(TAOS* taos) { taos_stmt_bind_param(stmt, qparams); if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute select statement.\033[0m\n"); + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); return; } @@ -612,10 +614,10 @@ void verify_prepare2(TAOS* taos) { int rows = 0; int num_fields = taos_num_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result); - char temp[256]; // fetch the records row by row while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; rows++; taos_print_row(temp, row, fields, num_fields); printf("%s\n", temp); @@ -623,10 +625,17 @@ void verify_prepare2(TAOS* taos) { taos_free_result(result); taos_stmt_close(stmt); + + free(t8_len); + free(t16_len); + free(t32_len); + free(t64_len); + free(float_len); + free(double_len); + free(bin_len); + free(blob_len); } - - void verify_prepare3(TAOS* taos) { TAOS_RES* result = taos_query(taos, "drop database if exists test;"); taos_free_result(result); @@ -775,12 +784,16 @@ void verify_prepare3(TAOS* taos) { sql = "insert into ? using st1 tags(?,?) values(?,?,?,?,?,?,?,?,?,?)"; code = taos_stmt_prepare(stmt, sql, 0); if (code != 0){ - printf("\033[31mfailed to execute taos_stmt_prepare. code:0x%x\033[0m\n", code); + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; } code = taos_stmt_set_tbname_tags(stmt, "m1", tags); if (code != 0){ - printf("\033[31mfailed to execute taos_stmt_prepare. code:0x%x\033[0m\n", code); + printf("\033[31mfailed to execute taos_stmt_prepare. error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); + return; } int64_t ts = 1591060628000; @@ -810,12 +823,12 @@ void verify_prepare3(TAOS* taos) { blob_len[i] = (int32_t)strlen(v.blob[i]); } - taos_stmt_bind_param_batch(stmt, params); taos_stmt_add_batch(stmt); if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute insert statement.\033[0m\n"); + printf("\033[31mfailed to execute insert statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); return; } taos_stmt_close(stmt); @@ -842,7 +855,8 @@ void verify_prepare3(TAOS* taos) { taos_stmt_bind_param(stmt, qparams); if (taos_stmt_execute(stmt) != 0) { - printf("\033[31mfailed to execute select statement.\033[0m\n"); + printf("\033[31mfailed to execute select statement.error:%s\033[0m\n", taos_stmt_errstr(stmt)); + taos_stmt_close(stmt); return; } @@ -852,10 +866,10 @@ void verify_prepare3(TAOS* taos) { int rows = 0; int num_fields = taos_num_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result); - char temp[256]; // fetch the records row by row while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; rows++; taos_print_row(temp, row, fields, num_fields); printf("%s\n", temp); @@ -863,10 +877,17 @@ void verify_prepare3(TAOS* taos) { taos_free_result(result); taos_stmt_close(stmt); + + free(t8_len); + free(t16_len); + free(t32_len); + free(t64_len); + free(float_len); + free(double_len); + free(bin_len); + free(blob_len); } - - void retrieve_callback(void *param, TAOS_RES *tres, int numOfRows) { if (numOfRows > 0) { diff --git a/tests/examples/c/demo.c b/tests/examples/c/demo.c index 0b1cd7b5d2..f8c69d0043 100644 --- a/tests/examples/c/demo.c +++ b/tests/examples/c/demo.c @@ -116,12 +116,12 @@ void Test(TAOS *taos, char *qstr, int index) { int rows = 0; int num_fields = taos_field_count(result); TAOS_FIELD *fields = taos_fetch_fields(result); - char temp[1024]; printf("num_fields = %d\n", num_fields); printf("select * from table, result:\n"); // fetch the records row by row while ((row = taos_fetch_row(result))) { + char temp[1024] = {0}; rows++; taos_print_row(temp, row, fields, num_fields); printf("%s\n", temp); diff --git a/tests/examples/c/prepare.c b/tests/examples/c/prepare.c index 13d71beea6..723b340a92 100644 --- a/tests/examples/c/prepare.c +++ b/tests/examples/c/prepare.c @@ -184,10 +184,10 @@ int main(int argc, char *argv[]) int rows = 0; int num_fields = taos_num_fields(result); TAOS_FIELD *fields = taos_fetch_fields(result); - char temp[256]; // fetch the records row by row while ((row = taos_fetch_row(result))) { + char temp[256] = {0}; rows++; taos_print_row(temp, row, fields, num_fields); printf("%s\n", temp); diff --git a/tests/examples/c/subscribe.c b/tests/examples/c/subscribe.c index 1d3533fa5e..ad12f0e7a5 100644 --- a/tests/examples/c/subscribe.c +++ b/tests/examples/c/subscribe.c @@ -14,8 +14,6 @@ void print_result(TAOS_RES* res, int blockFetch) { int num_fields = taos_num_fields(res); TAOS_FIELD* fields = taos_fetch_fields(res); int nRows = 0; - char buf[4096]; - if (blockFetch) { nRows = taos_fetch_block(res, &row); @@ -25,6 +23,7 @@ void print_result(TAOS_RES* res, int blockFetch) { //} } else { while ((row = taos_fetch_row(res))) { + char buf[4096] = {0}; taos_print_row(buf, row, fields, num_fields); puts(buf); nRows++; diff --git a/tests/mas/Jenkinsfile b/tests/mas/Jenkinsfile index 0e6e94a037..ae2286298f 100644 --- a/tests/mas/Jenkinsfile +++ b/tests/mas/Jenkinsfile @@ -21,7 +21,7 @@ def pre_test(){ cmake .. > /dev/null make > /dev/null make install > /dev/null - pip3 install ${WKC}/src/connector/python/linux/python3/ + pip3 install ${WKC}/src/connector/python/ || echo 0 ''' return 1 } diff --git a/tests/pytest/alter/alter_cacheLastRow.py b/tests/pytest/alter/alter_cacheLastRow.py new file mode 100644 index 0000000000..36a2864d0f --- /dev/null +++ b/tests/pytest/alter/alter_cacheLastRow.py @@ -0,0 +1,109 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from datetime import datetime + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,15,0) + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath + "/build/bin/" + + #write 5M rows into db, then restart to force the data move into disk. + #create 500 tables + os.system("%staosdemo -f tools/taosdemoAllTest/insert_5M_rows.json -y " % binPath) + tdDnodes.stop(1) + tdDnodes.start(1) + tdSql.execute('use db') + + #prepare to query 500 tables last_row() + tableName = [] + for i in range(500): + tableName.append(f"stb_{i}") + tdSql.execute('use db') + lastRow_Off_start = datetime.now() + + slow = 0 #count time where lastRow on is slower + for i in range(5): + #switch lastRow to off and check + tdSql.execute('alter database db cachelast 0') + tdSql.query('show databases') + tdSql.checkData(0,15,0) + + #run last_row(*) query 500 times + for i in range(500): + tdSql.execute(f'SELECT LAST_ROW(*) FROM {tableName[i]}') + lastRow_Off_end = datetime.now() + + tdLog.debug(f'time used:{lastRow_Off_end-lastRow_Off_start}') + + #switch lastRow to on and check + tdSql.execute('alter database db cachelast 1') + tdSql.query('show databases') + tdSql.checkData(0,15,1) + + #run last_row(*) query 500 times + tdSql.execute('use db') + lastRow_On_start = datetime.now() + for i in range(500): + tdSql.execute(f'SELECT LAST_ROW(*) FROM {tableName[i]}') + lastRow_On_end = datetime.now() + + tdLog.debug(f'time used:{lastRow_On_end-lastRow_On_start}') + + #check which one used more time + if (lastRow_Off_end-lastRow_Off_start > lastRow_On_end-lastRow_On_start): + pass + else: + slow += 1 + tdLog.debug(slow) + if slow > 1: #tolerance for the first time + tdLog.exit('lastRow hot alter failed') + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/alter/alter_create_exception.py b/tests/pytest/alter/alter_create_exception.py new file mode 100644 index 0000000000..19f1ba9464 --- /dev/null +++ b/tests/pytest/alter/alter_create_exception.py @@ -0,0 +1,91 @@ +################################################################### +# 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 -*- + +#TODO: after TD-4518 and TD-4510 is resolved, add the exception test case for these situations + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + #checking string input exception for alter + tdSql.error("alter database db keep '10'") + tdSql.error('alter database db keep "10"') + tdSql.error("alter database db keep '\t'") + tdSql.error("alter database db keep \'\t\'") + tdSql.error('alter database db keep "a"') + tdSql.error('alter database db keep "1.4"') + tdSql.error("alter database db blocks '10'") + tdSql.error('alter database db comp "0"') + tdSql.execute('drop database if exists db') + + #checking string input exception for create + tdSql.error("create database db comp '0'") + tdSql.error('create database db comp "1"') + tdSql.error("create database db comp '\t'") + tdSql.error("alter database db keep \'\t\'") + tdSql.error('create database db comp "a"') + tdSql.error('create database db comp "1.4"') + tdSql.error("create database db blocks '10'") + tdSql.error('create database db keep "3650"') + tdSql.error('create database db fsync "3650"') + tdSql.execute('create database db precision "us"') + tdSql.query('show databases') + tdSql.checkData(0,16,'us') + tdSql.execute('drop database if exists db') + + #checking float input exception for create + tdSql.error("create database db fsync 7.3") + tdSql.error("create database db fsync 0.0") + tdSql.error("create database db fsync -5.32") + tdSql.error('create database db comp 7.2') + tdSql.error("create database db blocks 5.87") + tdSql.error('create database db keep 15.4') + + #checking float input exception for insert + tdSql.execute('create database db') + tdSql.error('alter database db blocks 5.9') + tdSql.error('alter database db blocks -4.7') + tdSql.error('alter database db blocks 0.0') + tdSql.error('alter database db keep 15.4') + tdSql.error('alter database db comp 2.67') + + #checking additional exception param for alter keep + tdSql.error('alter database db keep 365001') + tdSql.error('alter database db keep 364999,365000,365001') + tdSql.error('alter database db keep -10') + tdSql.error('alter database db keep 5') + tdSql.error('alter database db keep ') + tdSql.error('alter database db keep 40,a,60') + tdSql.error('alter database db keep ,,60,') + tdSql.error('alter database db keep \t') + tdSql.execute('alter database db keep \t50') + tdSql.query('show databases') + tdSql.checkData(0,7,'50,50,50') + + 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/pytest/alter/alter_keep.py b/tests/pytest/alter/alter_keep.py new file mode 100644 index 0000000000..b23f364fc6 --- /dev/null +++ b/tests/pytest/alter/alter_keep.py @@ -0,0 +1,208 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +import time + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def alterKeepCommunity(self): + tdLog.notice('running Keep Test, Community Version') + tdLog.notice('running parameter test for keep during create') + #testing keep parameter during create + tdSql.query('show databases') + tdSql.checkData(0,7,'3650') + tdSql.execute('drop database db') + + tdSql.execute('create database db keep 100') + tdSql.query('show databases') + tdSql.checkData(0,7,'100') + tdSql.execute('drop database db') + + tdSql.error('create database db keep ') + tdSql.error('create database db keep 0') + tdSql.error('create database db keep 10,20') + tdSql.error('create database db keep 10,20,30') + tdSql.error('create database db keep 20,30,40,50') + + #testing keep parameter during alter + tdSql.execute('create database db') + tdLog.notice('running parameter test for keep during alter') + + tdSql.execute('alter database db keep 100') + tdSql.query('show databases') + tdSql.checkData(0,7,'100') + + tdSql.error('alter database db keep ') + tdSql.error('alter database db keep 0') + tdSql.error('alter database db keep 10,20') + tdSql.error('alter database db keep 10,20,30') + tdSql.error('alter database db keep 20,30,40,50') + tdSql.query('show databases') + tdSql.checkData(0,7,'100') + + def alterKeepEnterprise(self): + tdLog.notice('running Keep Test, Enterprise Version') + #testing keep parameter during create + tdLog.notice('running parameter test for keep during create') + + tdSql.query('show databases') + tdSql.checkData(0,7,'3650,3650,3650') + tdSql.execute('drop database db') + + tdSql.execute('create database db keep 100') + tdSql.query('show databases') + tdSql.checkData(0,7,'100,100,100') + tdSql.execute('drop database db') + + tdSql.execute('create database db keep 20, 30') + tdSql.query('show databases') + tdSql.checkData(0,7,'20,30,30') + tdSql.execute('drop database db') + + tdSql.execute('create database db keep 30,40,50') + tdSql.query('show databases') + tdSql.checkData(0,7,'30,40,50') + tdSql.execute('drop database db') + + tdSql.error('create database db keep ') + tdSql.error('create database db keep 20,30,40,50') + tdSql.error('create database db keep 0') + tdSql.error('create database db keep 100,50') + tdSql.error('create database db keep 100,40,50') + tdSql.error('create database db keep 20,100,50') + tdSql.error('create database db keep 50,60,20') + + #testing keep parameter during alter + tdSql.execute('create database db') + tdLog.notice('running parameter test for keep during alter') + + tdSql.execute('alter database db keep 10') + tdSql.query('show databases') + tdSql.checkData(0,7,'10,10,10') + + tdSql.execute('alter database db keep 20,30') + tdSql.query('show databases') + tdSql.checkData(0,7,'20,30,30') + + tdSql.execute('alter database db keep 100,200,300') + tdSql.query('show databases') + tdSql.checkData(0,7,'100,200,300') + + tdSql.error('alter database db keep ') + tdSql.error('alter database db keep 20,30,40,50') + tdSql.error('alter database db keep 0') + tdSql.error('alter database db keep 100,50') + tdSql.error('alter database db keep 100,40,50') + tdSql.error('alter database db keep 20,100,50') + tdSql.error('alter database db keep 50,60,20') + tdSql.query('show databases') + tdSql.checkData(0,7,'100,200,300') + + + def run(self): + tdSql.prepare() + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + tdLog.debug('running enterprise test') + self.alterKeepEnterprise() + else: + tdLog.debug('running community test') + self.alterKeepCommunity() + + tdSql.prepare() + + + ## preset the keep + tdSql.prepare() + + tdLog.notice('testing if alter will cause any error') + tdSql.execute('create table tb (ts timestamp, speed int)') + tdSql.execute('alter database db keep 10,10,10') + tdSql.execute('insert into tb values (now, 10)') + tdSql.execute('insert into tb values (now + 10m, 10)') + tdSql.query('select * from tb') + tdSql.checkRows(2) + + + #after alter from small to large, check if the alter if functioning + #test if change through test.py is consistent with change from taos client + #test case for TD-4459 and TD-4445 + tdLog.notice('testing keep will be altered changing from small to big') + tdSql.execute('alter database db keep 40,40,40') + tdSql.query('show databases') + tdSql.checkData(0,7,'40,40,40') + tdSql.error('insert into tb values (now-60d, 10)') + tdSql.execute('insert into tb values (now-30d, 10)') + tdSql.query('select * from tb') + tdSql.checkRows(3) + + rowNum = 3 + for i in range(30): + rowNum += 1 + tdSql.execute('alter database db keep 20,20,20') + tdSql.execute('alter database db keep 40,40,40') + tdSql.query('show databases') + tdSql.checkData(0,7,'40,40,40') + tdSql.error('insert into tb values (now-60d, 10)') + tdSql.execute('insert into tb values (now-30d, 10)') + tdSql.query('select * from tb') + tdSql.checkRows(rowNum) + + tdLog.notice('testing keep will be altered changing from big to small') + tdSql.execute('alter database db keep 10,10,10') + tdSql.query('show databases') + tdSql.checkData(0,7,'10,10,10') + tdSql.error('insert into tb values (now-15d, 10)') + tdSql.query('select * from tb') + tdSql.checkRows(2) + + rowNum = 2 + tdLog.notice('testing keep will be altered if sudden change from small to big') + for i in range(30): + tdSql.execute('alter database db keep 14,14,14') + tdSql.execute('alter database db keep 16,16,16') + tdSql.execute('insert into tb values (now-15d, 10)') + tdSql.query('select * from tb') + rowNum += 1 + tdSql.checkRows(rowNum) + + tdLog.notice('testing keep will be altered if sudden change from big to small') + tdSql.execute('alter database db keep 16,16,16') + tdSql.execute('alter database db keep 14,14,14') + tdSql.error('insert into tb values (now-15d, 10)') + tdSql.query('select * from tb') + tdSql.checkRows(2) + + tdLog.notice('testing data will show up again when keep is being changed to large value') + tdSql.execute('alter database db keep 40,40,40') + tdSql.query('select * from tb') + tdSql.checkRows(63) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/client/change_time_1_1.py b/tests/pytest/client/change_time_1_1.py new file mode 100644 index 0000000000..acdea17fbf --- /dev/null +++ b/tests/pytest/client/change_time_1_1.py @@ -0,0 +1,88 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.pathFinding import * +from util.dnodes import tdDnodes +from datetime import datetime +import subprocess +import time + +##TODO: this is now automatic, but not sure if this will run through jenkins +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + tdFindPath.init(__file__) + + def run(self): + tdSql.prepare() + binPath = tdFindPath.getTaosdemoPath() + TDenginePath = tdFindPath.getTDenginePath() + + ## change system time to 2020/10/20 + os.system('sudo timedatectl set-ntp off') + tdLog.sleep(10) + os.system('sudo timedatectl set-time 2020-10-20') + + #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 + #11 data files should be generated + #vnode at TDinternal/community/sim/dnode1/data/vnode + try: + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + if result.count('data') != 11: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + tdLog.exit('wrong number of files') + else: + tdLog.debug("data file number correct") + + #move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write + #leaving 7 data files. + try: + os.system ('timedatectl set-time 2020-10-25') + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + print(result.count('data')) + if result.count('data') != 7: + tdLog.exit('wrong number of files') + else: + tdLog.debug("data file number correct") + tdSql.query('select first(ts) from stb_0') + tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + + def stop(self): + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + tdSql.close() + tdLog.success("alter block manual check finish") + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/client/change_time_1_2.py b/tests/pytest/client/change_time_1_2.py new file mode 100644 index 0000000000..ec483b00be --- /dev/null +++ b/tests/pytest/client/change_time_1_2.py @@ -0,0 +1,100 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from util.pathFinding import * +from datetime import datetime +import subprocess + +##TODO: this is now automatic, but not sure if this will run through jenkins +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + tdFindPath.init(__file__) + + def run(self): + tdSql.prepare() + binPath = tdFindPath.getTaosdemoPath() + TDenginePath = tdFindPath.getTDenginePath() + + ## change system time to 2020/10/20 + os.system ('timedatectl set-ntp off') + tdLog.sleep(10) + os.system ('timedatectl set-time 2020-10-20') + + #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 + #11 data files should be generated + #vnode at TDinternal/community/sim/dnode1/data/vnode + try: + os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + + if result.count('data') != 11: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + tdLog.exit('wrong number of files') + else: + tdLog.debug("data file number correct") + + + try: + tdSql.query('select first(ts) from stb_0') #check the last data in the database + tdSql.checkData(0,0,datetime(2020,10,11,0,0,0,0)) + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + + #moves 5 days ahead to 2020/10/25 and restart taosd + #4 oldest data file should be removed from tsdb/data + #7 data file should be found + #vnode at TDinternal/community/sim/dnode1/data/vnode + + try: + os.system ('timedatectl set-time 2020-10-25') + tdDnodes.stop(1) + tdDnodes.start(1) + tdSql.query('select first(ts) from stb_0') + tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database + except BaseException: + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] + result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') + print(result.count('data')) + if result.count('data') != 7: + tdLog.exit('wrong number of files') + else: + tdLog.debug("data file number correct") + os.system('sudo timedatectl set-ntp on') + tdLog.sleep(10) + + def stop(self): + os.system('sudo timedatectl set-ntp on') + tdSql.close() + tdLog.success("alter block manual check finish") + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/cluster/clusterSetup.py b/tests/pytest/cluster/clusterSetup.py index 8a26427021..87414303f8 100644 --- a/tests/pytest/cluster/clusterSetup.py +++ b/tests/pytest/cluster/clusterSetup.py @@ -23,7 +23,8 @@ class Node: self.hostIP = hostIP self.hostName = hostName self.homeDir = homeDir - self.conn = Connection("{}@{}".format(username, hostName), connect_kwargs={"password": "{}".format(password)}) + self.corePath = '/coredump' + self.conn = Connection("{}@{}".format(username, hostName), connect_kwargs={"password": "{}".format(password)}) def buildTaosd(self): try: @@ -126,21 +127,37 @@ class Node: except Exception as e: print("remove taosd error for node %d " % self.index) logging.exception(e) + + + def detectCoredumpFile(self): + try: + result = self.conn.run("find /coredump -name 'core_*' ", hide=True) + output = result.stdout + print("output: %s" % output) + return output + except Exception as e: + print("find coredump file error on node %d " % self.index) + logging.exception(e) + class Nodes: def __init__(self): self.tdnodes = [] - self.tdnodes.append(Node(0, 'root', '52.143.103.7', 'node1', 'a', '/root/')) - self.tdnodes.append(Node(1, 'root', '52.250.48.222', 'node2', 'a', '/root/')) - self.tdnodes.append(Node(2, 'root', '51.141.167.23', 'node3', 'a', '/root/')) - self.tdnodes.append(Node(3, 'root', '52.247.207.173', 'node4', 'a', '/root/')) - self.tdnodes.append(Node(4, 'root', '51.141.166.100', 'node5', 'a', '/root/')) + self.tdnodes.append(Node(0, 'root', '192.168.17.194', 'taosdata', 'r', '/root/')) + # self.tdnodes.append(Node(1, 'root', '52.250.48.222', 'node2', 'a', '/root/')) + # self.tdnodes.append(Node(2, 'root', '51.141.167.23', 'node3', 'a', '/root/')) + # self.tdnodes.append(Node(3, 'root', '52.247.207.173', 'node4', 'a', '/root/')) + # self.tdnodes.append(Node(4, 'root', '51.141.166.100', 'node5', 'a', '/root/')) def stopOneNode(self, index): + self.tdnodes[index].stopTaosd() self.tdnodes[index].forceStopOneTaosd() def startOneNode(self, index): self.tdnodes[index].startOneTaosd() + + def detectCoredumpFile(self, index): + return self.tdnodes[index].detectCoredumpFile() def stopAllTaosd(self): for i in range(len(self.tdnodes)): @@ -166,14 +183,32 @@ class Nodes: for i in range(len(self.tdnodes)): self.tdnodes[i].removeData() -# kill taosd randomly every 10 mins -nodes = Nodes() -loop = 0 -while True: - loop = loop + 1 - index = random.randint(0, 4) - print("loop: %d, kill taosd on node%d" %(loop, index)) - nodes.stopOneNode(index) - time.sleep(60) - nodes.startOneNode(index) - time.sleep(600) \ No newline at end of file +class Test: + def __init__(self): + self.nodes = Nodes() + + # kill taosd randomly every 10 mins + def randomlyKillDnode(self): + loop = 0 + while True: + index = random.randint(0, 4) + print("loop: %d, kill taosd on node%d" %(loop, index)) + self.nodes.stopOneNode(index) + time.sleep(60) + self.nodes.startOneNode(index) + time.sleep(600) + loop = loop + 1 + + def detectCoredump(self): + loop = 0 + while True: + for i in range(len(self.nodes.tdnodes)): + result = self.nodes.detectCoredumpFile(i) + print("core file path is %s" % result) + if result and not result.isspace(): + self.nodes.stopAllTaosd() + print("sleep for 10 mins") + time.sleep(600) + +test = Test() +test.detectCoredump() \ No newline at end of file diff --git a/tests/pytest/crash_gen/crash_gen_main.py b/tests/pytest/crash_gen/crash_gen_main.py index 644aa79916..b743eee2ef 100755 --- a/tests/pytest/crash_gen/crash_gen_main.py +++ b/tests/pytest/crash_gen/crash_gen_main.py @@ -37,6 +37,7 @@ import requests import gc import taos + from .shared.types import TdColumns, TdTags # from crash_gen import ServiceManager, TdeInstance, TdeSubProcess @@ -160,6 +161,7 @@ class WorkerThread: Logging.debug("[TRD] Thread Coordinator not running any more, worker thread now stopping...") break + # Before we fetch the task and run it, let's ensure we properly "use" the database (not needed any more) try: if (Config.getConfig().per_thread_db_connection): # most likely TRUE @@ -1362,9 +1364,12 @@ class Task(): Progress.emit(Progress.ACCEPTABLE_ERROR) self._err = err else: # not an acceptable error - errMsg = "[=] Unexpected Taos library exception ({}): errno=0x{:X}, msg: {}, SQL: {}".format( + shortTid = threading.get_ident() % 10000 + errMsg = "[=] Unexpected Taos library exception ({}): errno=0x{:X}, thread={}, msg: {}, SQL: {}".format( self.__class__.__name__, - errno2, err, wt.getDbConn().getLastSql()) + errno2, + shortTid, + err, wt.getDbConn().getLastSql()) self.logDebug(errMsg) if Config.getConfig().debug: # raise # so that we see full stack @@ -1411,21 +1416,31 @@ class Task(): def lockTable(self, ftName): # full table name # print(" <<" + ftName + '_', end="", flush=True) - with Task._lock: - if not ftName in Task._tableLocks: + with Task._lock: # SHORT lock! so we only protect lock creation + if not ftName in Task._tableLocks: # Create new lock and add to list, if needed Task._tableLocks[ftName] = threading.Lock() - Task._tableLocks[ftName].acquire() + # No lock protection, anybody can do this any time + lock = Task._tableLocks[ftName] + # Logging.info("Acquiring lock: {}, {}".format(ftName, lock)) + lock.acquire() + # Logging.info("Acquiring lock successful: {}".format(lock)) def unlockTable(self, ftName): # print('_' + ftName + ">> ", end="", flush=True) - with Task._lock: + with Task._lock: if not ftName in self._tableLocks: raise RuntimeError("Corrupt state, no such lock") lock = Task._tableLocks[ftName] if not lock.locked(): raise RuntimeError("Corrupte state, already unlocked") - lock.release() + + # Important note, we want to protect unlocking under the task level + # locking, because we don't want the lock to be deleted (maybe in the futur) + # while we unlock it + # Logging.info("Releasing lock: {}".format(lock)) + lock.release() + # Logging.info("Releasing lock successful: {}".format(lock)) class ExecutionStats: @@ -1696,6 +1711,11 @@ class TdSuperTable: return dbc.query("SELECT * FROM {}.{}".format(self._dbName, self._stName)) > 0 def ensureRegTable(self, task: Optional[Task], dbc: DbConn, regTableName: str): + ''' + Make sure a regular table exists for this super table, creating it if necessary. + If there is an associated "Task" that wants to do this, "lock" this table so that + others don't access it while we create it. + ''' dbName = self._dbName sql = "select tbname from {}.{} where tbname in ('{}')".format(dbName, self._stName, regTableName) if dbc.query(sql) >= 1 : # reg table exists already @@ -1703,18 +1723,24 @@ class TdSuperTable: # acquire a lock first, so as to be able to *verify*. More details in TD-1471 fullTableName = dbName + '.' + regTableName - if task is not None: # TODO: what happens if we don't lock the table - task.lockTable(fullTableName) + if task is not None: # Somethime thie operation is requested on behalf of a "task" + # Logging.info("Locking table for creation: {}".format(fullTableName)) + task.lockTable(fullTableName) # in which case we'll lock this table to ensure serialized access + # Logging.info("Table locked for creation".format(fullTableName)) Progress.emit(Progress.CREATE_TABLE_ATTEMPT) # ATTEMPT to create a new table # print("(" + fullTableName[-3:] + ")", end="", flush=True) try: sql = "CREATE TABLE {} USING {}.{} tags ({})".format( fullTableName, dbName, self._stName, self._getTagStrForSql(dbc) ) + # Logging.info("Creating regular with SQL: {}".format(sql)) dbc.execute(sql) + # Logging.info("Regular table created: {}".format(sql)) finally: if task is not None: + # Logging.info("Unlocking table after creation: {}".format(fullTableName)) task.unlockTable(fullTableName) # no matter what + # Logging.info("Table unlocked after creation: {}".format(fullTableName)) def _getTagStrForSql(self, dbc) : tags = self._getTags(dbc) @@ -2011,9 +2037,30 @@ class TaskAddData(StateTransitionTask): def canBeginFrom(cls, state: AnyState): return state.canAddData() + def _lockTableIfNeeded(self, fullTableName, extraMsg = ''): + if Config.getConfig().verify_data: + # Logging.info("Locking table: {}".format(fullTableName)) + self.lockTable(fullTableName) + # Logging.info("Table locked {}: {}".format(extraMsg, fullTableName)) + # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written + else: + # Logging.info("Skipping locking table") + pass + + def _unlockTableIfNeeded(self, fullTableName): + if Config.getConfig().verify_data: + # Logging.info("Unlocking table: {}".format(fullTableName)) + self.unlockTable(fullTableName) + # Logging.info("Table unlocked: {}".format(fullTableName)) + else: + pass + # Logging.info("Skipping unlocking table") + def _addDataInBatch(self, db, dbc, regTableName, te: TaskExecutor): numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS + fullTableName = db.getName() + '.' + regTableName + self._lockTableIfNeeded(fullTableName, 'batch') sql = "INSERT INTO {} VALUES ".format(fullTableName) for j in range(numRecords): # number of records per table @@ -2021,51 +2068,60 @@ class TaskAddData(StateTransitionTask): nextTick = db.getNextTick() nextColor = db.getNextColor() sql += "('{}', {}, '{}');".format(nextTick, nextInt, nextColor) - dbc.execute(sql) + + # Logging.info("Adding data in batch: {}".format(sql)) + try: + dbc.execute(sql) + finally: + # Logging.info("Data added in batch: {}".format(sql)) + self._unlockTableIfNeeded(fullTableName) + + def _addData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS for j in range(numRecords): # number of records per table - nextInt = db.getNextInt() + intToWrite = db.getNextInt() nextTick = db.getNextTick() nextColor = db.getNextColor() if Config.getConfig().record_ops: self.prepToRecordOps() if self.fAddLogReady is None: raise CrashGenError("Unexpected empty fAddLogReady") - self.fAddLogReady.write("Ready to write {} to {}\n".format(nextInt, regTableName)) + self.fAddLogReady.write("Ready to write {} to {}\n".format(intToWrite, regTableName)) self.fAddLogReady.flush() os.fsync(self.fAddLogReady.fileno()) # TODO: too ugly trying to lock the table reliably, refactor... fullTableName = db.getName() + '.' + regTableName - if Config.getConfig().verify_data: - self.lockTable(fullTableName) - # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written - + self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock + try: sql = "INSERT INTO {} VALUES ('{}', {}, '{}');".format( # removed: tags ('{}', {}) fullTableName, # ds.getFixedSuperTableName(), # ds.getNextBinary(), ds.getNextFloat(), - nextTick, nextInt, nextColor) + nextTick, intToWrite, nextColor) + # Logging.info("Adding data: {}".format(sql)) dbc.execute(sql) + # Logging.info("Data added: {}".format(sql)) + intWrote = intToWrite # Quick hack, attach an update statement here. TODO: create an "update" task if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB - nextInt = db.getNextInt() + intToUpdate = db.getNextInt() # Updated, but should not succeed nextColor = db.getNextColor() sql = "INSERt INTO {} VALUES ('{}', {}, '{}');".format( # "INSERt" means "update" here fullTableName, - nextTick, nextInt, nextColor) + nextTick, intToUpdate, nextColor) # sql = "UPDATE {} set speed={}, color='{}' WHERE ts='{}'".format( # fullTableName, db.getNextInt(), db.getNextColor(), nextTick) dbc.execute(sql) + intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this. except: # Any exception at all - if Config.getConfig().verify_data: - self.unlockTable(fullTableName) + self._unlockTableIfNeeded(fullTableName) raise # Now read it back and verify, we might encounter an error if table is dropped @@ -2073,33 +2129,41 @@ class TaskAddData(StateTransitionTask): try: readBack = dbc.queryScalar("SELECT speed from {}.{} WHERE ts='{}'". format(db.getName(), regTableName, nextTick)) - if readBack != nextInt : + if readBack != intWrote : raise taos.error.ProgrammingError( "Failed to read back same data, wrote: {}, read: {}" - .format(nextInt, readBack), 0x999) + .format(intWrote, readBack), 0x999) except taos.error.ProgrammingError as err: errno = Helper.convertErrno(err.errno) - if errno in [CrashGenError.INVALID_EMPTY_RESULT, CrashGenError.INVALID_MULTIPLE_RESULT] : # not a single result + if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result raise taos.error.ProgrammingError( - "Failed to read back same data for tick: {}, wrote: {}, read: {}" - .format(nextTick, nextInt, "Empty Result" if errno == CrashGenError.INVALID_EMPTY_RESULT else "Multiple Result"), + "Failed to read back same data for tick: {}, wrote: {}, read: EMPTY" + .format(nextTick, intWrote), + errno) + elif errno == CrashGenError.INVALID_MULTIPLE_RESULT : # multiple results + raise taos.error.ProgrammingError( + "Failed to read back same data for tick: {}, wrote: {}, read: MULTIPLE RESULTS" + .format(nextTick, intWrote), errno) elif errno in [0x218, 0x362]: # table doesn't exist # do nothing - dummy = 0 + pass else: # Re-throw otherwise raise finally: - self.unlockTable(fullTableName) # Unlock the table no matter what + self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock + # Done with read-back verification, unlock the table now + else: + self._unlockTableIfNeeded(fullTableName) # Successfully wrote the data into the DB, let's record it somehow - te.recordDataMark(nextInt) + te.recordDataMark(intWrote) if Config.getConfig().record_ops: if self.fAddLogDone is None: raise CrashGenError("Unexpected empty fAddLogDone") - self.fAddLogDone.write("Wrote {} to {}\n".format(nextInt, regTableName)) + self.fAddLogDone.write("Wrote {} to {}\n".format(intWrote, regTableName)) self.fAddLogDone.flush() os.fsync(self.fAddLogDone.fileno()) @@ -2137,15 +2201,16 @@ class TaskAddData(StateTransitionTask): class ThreadStacks: # stack info for all threads def __init__(self): self._allStacks = {} - allFrames = sys._current_frames() - for th in threading.enumerate(): + allFrames = sys._current_frames() # All current stack frames + for th in threading.enumerate(): # For each thread if th.ident is None: continue - stack = traceback.extract_stack(allFrames[th.ident]) - self._allStacks[th.native_id] = stack + stack = traceback.extract_stack(allFrames[th.ident]) # Get stack for a thread + shortTid = th.ident % 10000 + self._allStacks[shortTid] = stack # Was using th.native_id def print(self, filteredEndName = None, filterInternal = False): - for thNid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom + for tIdent, stack in self._allStacks.items(): # for each thread, stack frames top to bottom lastFrame = stack[-1] if filteredEndName: # we need to filter out stacks that match this name if lastFrame.name == filteredEndName : # end did not match @@ -2157,7 +2222,7 @@ class ThreadStacks: # stack info for all threads '__init__']: # the thread that extracted the stack continue # ignore # Now print - print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(thNid)) + print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(tIdent)) stackFrame = 0 for frame in stack: # was using: reversed(stack) # print(frame) @@ -2376,7 +2441,7 @@ class MainExec: action='store', default=0, type=int, - help='Maximum number of DBs to keep, set to disable dropping DB. (default: 0)') + help='Number of DBs to use, set to disable dropping DB. (default: 0)') parser.add_argument( '-c', '--connector-type', diff --git a/tests/pytest/crash_gen/service_manager.py b/tests/pytest/crash_gen/service_manager.py index 1cd65c1dde..c6685ec469 100644 --- a/tests/pytest/crash_gen/service_manager.py +++ b/tests/pytest/crash_gen/service_manager.py @@ -179,7 +179,7 @@ quorum 2 def getServiceCmdLine(self): # to start the instance if Config.getConfig().track_memory_leaks: Logging.info("Invoking VALGRIND on service...") - return ['exec /usr/bin/valgrind', '--leak-check=yes', self.getExecFile(), '-c', self.getCfgDir()] + return ['exec valgrind', '--leak-check=yes', self.getExecFile(), '-c', self.getCfgDir()] else: # TODO: move "exec -c" into Popen(), we can both "use shell" and NOT fork so ask to lose kill control return ["exec " + self.getExecFile(), '-c', self.getCfgDir()] # used in subproce.Popen() @@ -310,7 +310,7 @@ class TdeSubProcess: # print("Starting TDengine with env: ", myEnv.items()) print("Starting TDengine: {}".format(cmdLine)) - return Popen( + ret = Popen( ' '.join(cmdLine), # ' '.join(cmdLine) if useShell else cmdLine, shell=True, # Always use shell, since we need to pass ENV vars stdout=PIPE, @@ -318,6 +318,10 @@ class TdeSubProcess: close_fds=ON_POSIX, env=myEnv ) # had text=True, which interferred with reading EOF + time.sleep(0.01) # very brief wait, then let's check if sub process started successfully. + if ret.poll(): + raise CrashGenError("Sub process failed to start with command line: {}".format(cmdLine)) + return ret STOP_SIGNAL = signal.SIGINT # signal.SIGKILL/SIGINT # What signal to use (in kill) to stop a taosd process? SIG_KILL_RETCODE = 137 # ref: https://stackoverflow.com/questions/43268156/process-finished-with-exit-code-137-in-pycharm @@ -614,7 +618,7 @@ class ServiceManager: # Find if there's already a taosd service, and then kill it for proc in psutil.process_iter(): - if proc.name() == 'taosd': + if proc.name() == 'taosd' or proc.name() == 'memcheck-amd64-': # Regular or under Valgrind Logging.info("Killing an existing TAOSD process in 2 seconds... press CTRL-C to interrupt") time.sleep(2.0) proc.kill() diff --git a/tests/pytest/crash_gen/shared/misc.py b/tests/pytest/crash_gen/shared/misc.py index 90ad802ff1..78923bcc29 100644 --- a/tests/pytest/crash_gen/shared/misc.py +++ b/tests/pytest/crash_gen/shared/misc.py @@ -35,7 +35,8 @@ class LoggingFilter(logging.Filter): class MyLoggingAdapter(logging.LoggerAdapter): def process(self, msg, kwargs): - return "[{:04d}] {}".format(threading.get_ident() % 10000, msg), kwargs + shortTid = threading.get_ident() % 10000 + return "[{:04d}] {}".format(shortTid, msg), kwargs # return '[%s] %s' % (self.extra['connid'], msg), kwargs diff --git a/tests/pytest/crash_gen/valgrind_taos.supp b/tests/pytest/crash_gen/valgrind_taos.supp index 5f6604ba77..376567b7e8 100644 --- a/tests/pytest/crash_gen/valgrind_taos.supp +++ b/tests/pytest/crash_gen/valgrind_taos.supp @@ -17517,4 +17517,229 @@ fun:taosGetFqdn fun:taosCheckGlobalCfg fun:taos_init_imp +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec_mtrand + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + fun:PyCode_New + fun:__Pyx_InitCachedConstants + fun:__pyx_pymod_exec__generator + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec_bit_generator + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__common + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__bounded_integers + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__mt19937 + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__philox + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__pcg64 + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__pyx_pymod_exec__sfc64 + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:__Pyx_InitCachedConstants + fun:__pyx_pymod_exec__generator + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + fun:PyCode_New + fun:__pyx_pymod_exec_mtrand + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + fun:PyCode_New + fun:__pyx_pymod_exec_bit_generator + fun:PyModule_ExecDef + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:__libc_alloc_buffer_allocate + fun:alloc_buffer_allocate + fun:__resolv_conf_allocate + fun:__resolv_conf_load + fun:__resolv_conf_get_current + fun:__res_vinit + fun:maybe_init + fun:context_get + fun:__resolv_context_get + fun:gaih_inet.constprop.7 + fun:getaddrinfo + fun:taosGetFqdn + fun:taosCheckGlobalCfg + fun:taos_init_imp } \ No newline at end of file diff --git a/tests/pytest/dbmgmt/nanoSecondCheck.py b/tests/pytest/dbmgmt/nanoSecondCheck.py new file mode 100644 index 0000000000..a5e9adacee --- /dev/null +++ b/tests/pytest/dbmgmt/nanoSecondCheck.py @@ -0,0 +1,219 @@ +# ################################################################# +# 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 -*- + +# TODO: after TD-4518 and TD-4510 is resolved, add the exception test case for these situations + +import sys +from util.log import * +from util.cases import * +from util.sql import * +import time +from datetime import datetime +import os + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db precision "ns";') + tdSql.query('show databases;') + tdSql.checkData(0,16,'ns') + tdSql.execute('use db') + + tdLog.debug('testing nanosecond support in 1st timestamp') + tdSql.execute('create table tb (ts timestamp, speed int)') + tdSql.execute('insert into tb values(\'2021-06-10 0:00:00.100000001\', 1);') + tdSql.execute('insert into tb values(1623254400150000000, 2);') + tdSql.execute('import into tb values(1623254400300000000, 3);') + tdSql.execute('import into tb values(1623254400299999999, 4);') + tdSql.execute('insert into tb values(1623254400300000001, 5);') + tdSql.execute('insert into tb values(1623254400999999999, 7);') + + + tdSql.query('select * from tb;') + tdSql.checkData(0,0,'2021-06-10 0:00:00.100000001') + tdSql.checkData(1,0,'2021-06-10 0:00:00.150000000') + tdSql.checkData(2,0,'2021-06-10 0:00:00.299999999') + tdSql.checkData(3,1,3) + tdSql.checkData(4,1,5) + tdSql.checkData(5,1,7) + tdSql.checkRows(6) + tdSql.query('select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400100000002;') + tdSql.checkData(0,0,1) + tdSql.query('select count(*) from tb where ts > \'2021-06-10 0:00:00.100000001\' and ts < \'2021-06-10 0:00:00.160000000\';') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400150000000;') + tdSql.checkData(0,0,1) + tdSql.query('select count(*) from tb where ts > \'2021-06-10 0:00:00.100000000\' and ts < \'2021-06-10 0:00:00.150000000\';') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb where ts > 1623254400400000000;') + tdSql.checkData(0,0,1) + tdSql.query('select count(*) from tb where ts < \'2021-06-10 00:00:00.400000000\';') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb where ts > now + 400000000b;') + tdSql.checkRows(0) + + tdSql.query('select count(*) from tb where ts >= \'2021-06-10 0:00:00.100000001\';') + tdSql.checkData(0,0,6) + + tdSql.query('select count(*) from tb where ts <= 1623254400300000000;') + tdSql.checkData(0,0,4) + + tdSql.query('select count(*) from tb where ts = \'2021-06-10 0:00:00.000000000\';') + tdSql.checkRows(0) + + tdSql.query('select count(*) from tb where ts = 1623254400150000000;') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb where ts = \'2021-06-10 0:00:00.100000001\';') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb where ts between 1623254400000000000 and 1623254400400000000;') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb where ts between \'2021-06-10 0:00:00.299999999\' and \'2021-06-10 0:00:00.300000001\';') + tdSql.checkData(0,0,3) + + tdSql.query('select avg(speed) from tb interval(5000000000b);') + tdSql.checkRows(1) + + tdSql.query('select avg(speed) from tb interval(100000000b)') + tdSql.checkRows(4) + + tdSql.error('select avg(speed) from tb interval(1b);') + tdSql.error('select avg(speed) from tb interval(999b);') + + tdSql.query('select avg(speed) from tb interval(1000b);') + tdSql.checkRows(5) + + tdSql.query('select avg(speed) from tb interval(1u);') + tdSql.checkRows(5) + + tdSql.query('select avg(speed) from tb interval(100000000b) sliding (100000000b);') + tdSql.checkRows(4) + + tdSql.query('select last(*) from tb') + tdSql.checkData(0,0, '2021-06-10 0:00:00.999999999') + tdSql.checkData(0,0, 1623254400999999999) + + tdSql.query('select first(*) from tb') + tdSql.checkData(0,0, 1623254400100000001) + tdSql.checkData(0,0, '2021-06-10 0:00:00.100000001') + + tdSql.execute('insert into tb values(now + 500000000b, 6);') + tdSql.query('select * from tb;') + tdSql.checkRows(7) + + tdLog.debug('testing nanosecond support in other timestamps') + tdSql.execute('create table tb2 (ts timestamp, speed int, ts2 timestamp);') + tdSql.execute('insert into tb2 values(\'2021-06-10 0:00:00.100000001\', 1, \'2021-06-11 0:00:00.100000001\');') + tdSql.execute('insert into tb2 values(1623254400150000000, 2, 1623340800150000000);') + tdSql.execute('import into tb2 values(1623254400300000000, 3, 1623340800300000000);') + tdSql.execute('import into tb2 values(1623254400299999999, 4, 1623340800299999999);') + tdSql.execute('insert into tb2 values(1623254400300000001, 5, 1623340800300000001);') + tdSql.execute('insert into tb2 values(1623254400999999999, 7, 1623513600999999999);') + + tdSql.query('select * from tb2;') + tdSql.checkData(0,0,'2021-06-10 0:00:00.100000001') + tdSql.checkData(1,0,'2021-06-10 0:00:00.150000000') + tdSql.checkData(2,1,4) + tdSql.checkData(3,1,3) + tdSql.checkData(4,2,'2021-06-11 00:00:00.300000001') + tdSql.checkData(5,2,'2021-06-13 00:00:00.999999999') + tdSql.checkRows(6) + tdSql.query('select count(*) from tb2 where ts2 > 1623340800000000000 and ts2 < 1623340800150000000;') + tdSql.checkData(0,0,1) + tdSql.query('select count(*) from tb2 where ts2 > \'2021-06-11 0:00:00.100000000\' and ts2 < \'2021-06-11 0:00:00.100000002\';') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb2 where ts2 > 1623340800500000000;') + tdSql.checkData(0,0,1) + tdSql.query('select count(*) from tb2 where ts2 < \'2021-06-11 0:00:00.400000000\';') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 > now + 400000000b;') + tdSql.checkRows(0) + + tdSql.query('select count(*) from tb2 where ts2 >= \'2021-06-11 0:00:00.100000001\';') + tdSql.checkData(0,0,6) + + tdSql.query('select count(*) from tb2 where ts2 <= 1623340800400000000;') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 = \'2021-06-11 0:00:00.000000000\';') + tdSql.checkRows(0) + + tdSql.query('select count(*) from tb2 where ts2 = \'2021-06-11 0:00:00.300000001\';') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb2 where ts2 = 1623340800300000001;') + tdSql.checkData(0,0,1) + + tdSql.query('select count(*) from tb2 where ts2 between 1623340800000000000 and 1623340800450000000;') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 between \'2021-06-11 0:00:00.299999999\' and \'2021-06-11 0:00:00.300000001\';') + tdSql.checkData(0,0,3) + + tdSql.query('select count(*) from tb2 where ts2 <> 1623513600999999999;') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 <> \'2021-06-11 0:00:00.100000001\';') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 <> \'2021-06-11 0:00:00.100000000\';') + tdSql.checkData(0,0,6) + + tdSql.query('select count(*) from tb2 where ts2 != 1623513600999999999;') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 != \'2021-06-11 0:00:00.100000001\';') + tdSql.checkData(0,0,5) + + tdSql.query('select count(*) from tb2 where ts2 != \'2021-06-11 0:00:00.100000000\';') + tdSql.checkData(0,0,6) + + tdSql.execute('insert into tb2 values(now + 500000000b, 6, now +2d);') + tdSql.query('select * from tb2;') + tdSql.checkRows(7) + + tdLog.debug('testing ill nanosecond format handling') + tdSql.execute('create table tb3 (ts timestamp, speed int);') + + tdSql.error('insert into tb3 values(16232544001500000, 2);') + tdSql.execute('insert into tb3 values(\'2021-06-10 0:00:00.123456\', 2);') + tdSql.query('select * from tb3 where ts = \'2021-06-10 0:00:00.123456000\';') + tdSql.checkRows(1) + + tdSql.execute('insert into tb3 values(\'2021-06-10 0:00:00.123456789000\', 2);') + tdSql.query('select * from tb3 where ts = \'2021-06-10 0:00:00.123456789\';') + tdSql.checkRows(1) + + os.system('sudo timedatectl set-ntp on') + + 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/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py b/tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py index ee663f89b0..43e281f437 100644 --- a/tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py +++ b/tests/pytest/dockerCluster/OneMnodeMultipleVnodesTest.py @@ -12,9 +12,6 @@ # -*- coding: utf-8 -*- from basic import * -from util.sql import tdSql - - class TDTestCase: @@ -36,4 +33,6 @@ td = TDTestCase() td.init() +## usage: python3 OneMnodeMultipleVnodesTest.py + diff --git a/tests/pytest/dockerCluster/basic.py b/tests/pytest/dockerCluster/basic.py index 50914b0be9..871d69790d 100644 --- a/tests/pytest/dockerCluster/basic.py +++ b/tests/pytest/dockerCluster/basic.py @@ -44,7 +44,16 @@ class BuildDockerCluser: "jnidebugFlag":"135", "qdebugFlag":"135", "maxSQLLength":"1048576" - } + } + cmd = "mkdir -p %s" % self.dockerDir + self.execCmd(cmd) + + cmd = "cp *.yml %s" % self.dockerDir + self.execCmd(cmd) + + cmd = "cp Dockerfile %s" % self.dockerDir + self.execCmd(cmd) + # execute command, and return the output # ref: https://blog.csdn.net/wowocpp/article/details/80775650 @@ -81,7 +90,7 @@ class BuildDockerCluser: def removeFile(self, rootDir, index, dir): cmd = "rm -rf %s/node%d/%s/*" % (rootDir, index, dir) self.execCmd(cmd) - + def clearEnv(self): cmd = "cd %s && docker-compose down --remove-orphans" % self.dockerDir self.execCmd(cmd) @@ -108,10 +117,14 @@ class BuildDockerCluser: self.execCmd(cmd) def updateLocalhosts(self): - cmd = "grep '172.27.0.7 *tdnode1' /etc/hosts" + cmd = "grep '172.27.0.7 *tdnode1' /etc/hosts | sed 's: ::g'" result = self.execCmdAndGetOutput(cmd) - if result and not result.isspace(): + print(result) + if result is None or result.isspace(): + print("==========") cmd = "echo '172.27.0.7 tdnode1' >> /etc/hosts" + display = "echo %s" % cmd + self.execCmd(display) self.execCmd(cmd) def deploy(self): @@ -138,13 +151,13 @@ class BuildDockerCluser: if self.numOfNodes < 2 or self.numOfNodes > 10: print("the number of nodes must be between 2 and 10") exit(0) - self.clearEnv() - self.createDirs() self.updateLocalhosts() self.deploy() def run(self): - cmd = "./buildClusterEnv.sh -n %d -v %s -d %s" % (self.numOfNodes, self.getTaosdVersion(), self.dockerDir) + cmd = "./buildClusterEnv.sh -n %d -v %s -d %s" % (self.numOfNodes, self.getTaosdVersion(), self.dockerDir) + display = "echo %s" % cmd + self.execCmd(display) self.execCmd(cmd) self.getConnection() self.createDondes() diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index c93fbc5eb3..2cbc3747f6 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -21,9 +21,12 @@ python3 insert/retentionpolicy.py python3 ./test.py -f insert/alterTableAndInsert.py python3 ./test.py -f insert/insertIntoTwoTables.py python3 ./test.py -f insert/before_1970.py +python3 ./test.py -f insert/special_character_show.py python3 bug2265.py python3 ./test.py -f insert/bug3654.py python3 ./test.py -f insert/insertDynamicColBeforeVal.py +python3 ./test.py -f insert/in_function.py +python3 ./test.py -f insert/modify_column.py #table python3 ./test.py -f table/alter_wal0.py @@ -31,7 +34,7 @@ python3 ./test.py -f table/column_name.py python3 ./test.py -f table/column_num.py python3 ./test.py -f table/db_table.py python3 ./test.py -f table/create_sensitive.py -#python3 ./test.py -f table/tablename-boundary.py +python3 ./test.py -f table/tablename-boundary.py python3 ./test.py -f table/max_table_length.py python3 ./test.py -f table/alter_column.py python3 ./test.py -f table/boundary.py @@ -70,8 +73,10 @@ python3 ./test.py -f tag_lite/int.py python3 ./test.py -f tag_lite/set.py python3 ./test.py -f tag_lite/smallint.py python3 ./test.py -f tag_lite/tinyint.py +python3 ./test.py -f tag_lite/timestamp.py #python3 ./test.py -f dbmgmt/database-name-boundary.py +python3 test.py -f dbmgmt/nanoSecondCheck.py python3 ./test.py -f import_merge/importBlock1HO.py python3 ./test.py -f import_merge/importBlock1HPO.py @@ -145,6 +150,7 @@ python3 ./test.py -f import_merge/importCSV.py #======================p2-start=============== # tools python3 test.py -f tools/taosdumpTest.py +python3 test.py -f tools/taosdumpTest2.py python3 test.py -f tools/taosdemoTest.py python3 test.py -f tools/taosdemoTestWithoutMetric.py @@ -229,7 +235,10 @@ python3 ./test.py -f query/queryFilterTswithDateUnit.py python3 ./test.py -f query/queryTscomputWithNow.py python3 ./test.py -f query/computeErrorinWhere.py python3 ./test.py -f query/queryTsisNull.py - +python3 ./test.py -f query/subqueryFilter.py +# python3 ./test.py -f query/nestedQuery/queryInterval.py +python3 ./test.py -f query/queryStateWindow.py +python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py #stream @@ -256,6 +265,8 @@ python3 ./test.py -f client/client.py python3 ./test.py -f client/version.py python3 ./test.py -f client/alterDatabase.py python3 ./test.py -f client/noConnectionErrorTest.py +# python3 test.py -f client/change_time_1_1.py +# python3 test.py -f client/change_time_1_2.py # Misc python3 testCompress.py @@ -283,6 +294,7 @@ python3 ./test.py -f topic/topicQuery.py python3 ./test.py -f update/merge_commit_data-0.py # wal python3 ./test.py -f wal/addOldWalTest.py +python3 ./test.py -f wal/sdbComp.py # function python3 ./test.py -f functions/all_null_value.py @@ -314,11 +326,16 @@ python3 ./test.py -f query/last_row_cache.py python3 ./test.py -f account/account_create.py python3 ./test.py -f alter/alter_table.py python3 ./test.py -f query/queryGroupbySort.py +python3 ./test.py -f functions/queryTestCases.py +python3 ./test.py -f functions/function_stateWindow.py +python3 ./test.py -f functions/function_derivative.py +python3 ./test.py -f functions/function_irate.py python3 ./test.py -f insert/unsignedInt.py python3 ./test.py -f insert/unsignedBigint.py python3 ./test.py -f insert/unsignedSmallint.py python3 ./test.py -f insert/unsignedTinyint.py +python3 ./test.py -f insert/insertFromCSV.py python3 ./test.py -f query/filterAllUnsignedIntTypes.py python3 ./test.py -f tag_lite/unsignedInt.py @@ -334,6 +351,10 @@ python3 ./test.py -f tag_lite/alter_tag.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +python3 ./test.py -f tag_lite/drop_auto_create.py python3 test.py -f insert/insert_before_use_db.py - +python3 test.py -f alter/alter_keep.py +python3 test.py -f alter/alter_cacheLastRow.py +python3 ./test.py -f query/querySession.py +python3 test.py -f alter/alter_create_exception.py #======================p4-end=============== diff --git a/tests/pytest/functions/function_derivative.py b/tests/pytest/functions/function_derivative.py new file mode 100644 index 0000000000..9d60129672 --- /dev/null +++ b/tests/pytest/functions/function_derivative.py @@ -0,0 +1,146 @@ +################################################################### +# 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 insertAndCheckData(self): + types = ["tinyint", "tinyint unsigned", "smallint", "smallint unsigned", "int", "int unsigned", "bigint", "bigint unsigned", "float", "double", "bool", "binary(20)", "nchar(20)"] + + for type in types: + print("============== create table using %s type ================" % type) + tdSql.execute("drop table if exists stb") + tdSql.execute("create table stb(ts timestamp, col %s) tags (id int)" % type) + tdSql.execute("create table tb1 using stb tags(1)") + tdSql.execute("create table tb2 using stb tags(2)") + + if type == "tinyint" or type == "smallint" or type == "int" or type == "bigint": + tdSql.execute("insert into tb1 values(%d, 1)(%d, 11)(%d, 21)" % (self.ts, self.ts + 10000, self.ts + 20000)) + tdSql.execute("insert into tb1 values(%d, -1)(%d, -11)(%d, -21)" % (self.ts + 30000, self.ts + 40000, self.ts + 50000)) + tdSql.execute("insert into tb2 values(%d, 10)(%d, 20)(%d, 30)" % (self.ts + 60000, self.ts + 70000, self.ts + 80000)) + tdSql.execute("insert into tb2 values(%d, -10)(%d, -20)(%d, -30)" % (self.ts + 90000, self.ts + 1000000, self.ts + 1100000)) + + tdSql.execute("insert into tb3 using stb tags(3) values(%d, 10)" % (self.ts + 1200000)) + + tdSql.query("select derivative(col, 1s, 1) from stb group by tbname") + tdSql.checkRows(4) + + tdSql.query("select derivative(col, 10s, 1) from stb group by tbname") + tdSql.checkRows(4) + + tdSql.query("select derivative(col, 10s, 0) from stb group by tbname") + tdSql.checkRows(10) + + tdSql.error("select derivative(col, 10s, 0) from tb1 group by tbname") + + tdSql.query("select derivative(col, 10s, 1) from tb1") + tdSql.checkRows(2) + + tdSql.query("select derivative(col, 10s, 0) from tb1") + tdSql.checkRows(5) + + tdSql.query("select derivative(col, 10s, 1) from tb2") + tdSql.checkRows(2) + + tdSql.query("select derivative(col, 10s, 0) from tb2") + tdSql.checkRows(5) + + tdSql.query("select derivative(col, 10s, 0) from tb3") + tdSql.checkRows(0) + + elif type == "tinyint unsigned" or type == "smallint unsigned" or type == "int unsigned" or type == "bigint unsigned": + tdSql.execute("insert into tb1 values(%d, 1)(%d, 11)(%d, 21)" % (self.ts, self.ts + 10000, self.ts + 20000)) + tdSql.execute("insert into tb2 values(%d, 10)(%d, 20)(%d, 30)" % (self.ts + 60000, self.ts + 70000, self.ts + 80000)) + + tdSql.error("select derivative(col, 1s, 1) from tb1") + tdSql.error("select derivative(col, 10s, 0) from tb1") + tdSql.error("select derivative(col, 999ms, 0) from tb1") + tdSql.error("select derivative(col, 1s, 1) from tb2") + tdSql.error("select derivative(col, 10s, 0) from tb2") + tdSql.error("select derivative(col, 999ms, 0) from tb2") + + elif type == "float" or type == "double": + tdSql.execute("insert into tb1 values(%d, 1.0)(%d, 11.0)(%d, 21.0)" % (self.ts, self.ts + 10000, self.ts + 20000)) + tdSql.execute("insert into tb2 values(%d, 3.0)(%d, 4.0)(%d, 5.0)" % (self.ts + 60000, self.ts + 70000, self.ts + 80000)) + + tdSql.query("select derivative(col, 10s, 1) from tb1") + tdSql.checkRows(2) + + tdSql.query("select derivative(col, 10s, 0) from tb1") + tdSql.checkRows(2) + + tdSql.query("select derivative(col, 10s, 1) from tb2") + tdSql.checkRows(2) + + tdSql.query("select derivative(col, 10s, 0) from tb2") + tdSql.checkRows(2) + + elif type == "bool": + tdSql.execute("insert into tb1 values(%d, true)(%d, false)(%d, true)" % (self.ts, self.ts + 10000, self.ts + 20000)) + tdSql.execute("insert into tb2 values(%d, false)(%d, true)(%d, true)" % (self.ts + 60000, self.ts + 70000, self.ts + 80000)) + + tdSql.error("select derivative(col, 1s, 1) from tb1") + tdSql.error("select derivative(col, 10s, 0) from tb1") + tdSql.error("select derivative(col, 999ms, 0) from tb1") + tdSql.error("select derivative(col, 1s, 1) from tb2") + tdSql.error("select derivative(col, 10s, 0) from tb2") + tdSql.error("select derivative(col, 999ms, 0) from tb2") + + else: + tdSql.execute("insert into tb1 values(%d, 'test01')(%d, 'test01')(%d, 'test01')" % (self.ts, self.ts + 10000, self.ts + 20000)) + tdSql.execute("insert into tb2 values(%d, 'test01')(%d, 'test01')(%d, 'test01')" % (self.ts + 60000, self.ts + 70000, self.ts + 80000)) + + tdSql.error("select derivative(col, 1s, 1) from tb1") + tdSql.error("select derivative(col, 10s, 0) from tb1") + tdSql.error("select derivative(col, 999ms, 0) from tb1") + tdSql.error("select derivative(col, 1s, 1) from tb2") + tdSql.error("select derivative(col, 10s, 0) from tb2") + tdSql.error("select derivative(col, 999ms, 0) from tb2") + + tdSql.error("select derivative(col, 10s, 1) from stb") + tdSql.error("select derivative(col, 10s, 1) from stb group by col") + tdSql.error("select derivative(col, 10s, 1) from stb group by id") + tdSql.error("select derivative(col, 999ms, 1) from stb group by id") + tdSql.error("select derivative(col, 10s, 2) from stb group by id") + + def run(self): + tdSql.prepare() + self.insertAndCheckData() + + tdSql.execute("create table st(ts timestamp, c1 int, c2 int) tags(id int)") + tdSql.execute("insert into dev1(ts, c1) using st tags(1) values(now, 1)") + + tdSql.error("select derivative(c1, 10s, 0) from (select c1 from st)") + tdSql.query("select diff(c1) from (select derivative(c1, 1s, 0) c1 from dev1)") + tdSql.checkRows(0) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_diff.py b/tests/pytest/functions/function_diff.py index 46ea3a86de..fba3b4c0d4 100644 --- a/tests/pytest/functions/function_diff.py +++ b/tests/pytest/functions/function_diff.py @@ -26,7 +26,20 @@ class TDTestCase: self.rowNum = 10 self.ts = 1537146000000 - + self.perfix = 'dev' + self.tables = 10 + + def insertData(self): + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, col int) tags(dev nchar(50))") + + for i in range(self.tables): + tdSql.execute("create table %s%d using st tags(%d)" % (self.perfix, i, i)) + rows = 15 + i + for j in range(rows): + tdSql.execute("insert into %s%d values(%d, %d)" %(self.perfix, i, self.ts + i * 20 * 10000 + j * 10000, j)) + def run(self): tdSql.prepare() @@ -99,6 +112,15 @@ class TDTestCase: tdSql.query("select diff(col6) from test1") tdSql.checkRows(10) + + self.insertData() + + tdSql.query("select diff(col) from st group by tbname") + tdSql.checkRows(185) + + tdSql.error("select diff(col) from st group by dev") + + tdSql.error("select diff(col) from st group by col") def stop(self): tdSql.close() diff --git a/tests/pytest/functions/function_diff_restart.py b/tests/pytest/functions/function_diff_restart.py index e03b892477..1e00309860 100644 --- a/tests/pytest/functions/function_diff_restart.py +++ b/tests/pytest/functions/function_diff_restart.py @@ -97,6 +97,12 @@ class TDTestCase: tdSql.query("select diff(col6) from test1") tdSql.checkRows(10) + + tdSql.query("select diff(col) from st group by tbname") + tdSql.checkRows(185) + + tdSql.error("select diff(col) from st group by dev") + tdSql.error("select diff(col) from st group by col") def stop(self): tdSql.close() diff --git a/tests/pytest/functions/function_irate.py b/tests/pytest/functions/function_irate.py new file mode 100644 index 0000000000..2c85e1bbdd --- /dev/null +++ b/tests/pytest/functions/function_irate.py @@ -0,0 +1,228 @@ +################################################################### +# 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 = 100 + self.ts = 1537146000000 + self.ts1 = 1537146000000000 + + + def run(self): + # db precison ms + tdSql.prepare() + tdSql.execute('''create table test(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), tag1 int)''') + tdSql.execute("create table test1 using test tags('beijing', 10)") + tdSql.execute("create table gtest1 (ts timestamp, col1 float)") + tdSql.execute("create table gtest2 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest3 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest4 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest5 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest6 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest7 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest8 (ts timestamp, col1 tinyint)") + + + 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*1000, i + 1, i + 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.execute("insert into gtest1 values(1537146000000,0);") + tdSql.execute("insert into gtest1 values(1537146001100,1.2);") + tdSql.execute("insert into gtest2 values(1537146001001,1);") + tdSql.execute("insert into gtest2 values(1537146001101,2);") + tdSql.execute("insert into gtest3 values(1537146001101,2);") + tdSql.execute("insert into gtest4(ts) values(1537146001101);") + tdSql.execute("insert into gtest5 values(1537146001002,4);") + tdSql.execute("insert into gtest5 values(1537146002202,4);") + tdSql.execute("insert into gtest6 values(1537146000000,5);") + tdSql.execute("insert into gtest6 values(1537146001000,2);") + tdSql.execute("insert into gtest7 values(1537146001000,1);") + tdSql.execute("insert into gtest7 values(1537146008000,2);") + tdSql.execute("insert into gtest7 values(1537146009000,6);") + tdSql.execute("insert into gtest7 values(1537146012000,3);") + tdSql.execute("insert into gtest7 values(1537146015000,3);") + tdSql.execute("insert into gtest7 values(1537146017000,1);") + tdSql.execute("insert into gtest7 values(1537146019000,3);") + tdSql.execute("insert into gtest8 values(1537146000002,4);") + tdSql.execute("insert into gtest8 values(1537146002202,4);") + + # irate verifacation + tdSql.query("select irate(col1) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col1) from test1 interval(10s);") + tdSql.checkData(0, 1, 1) + tdSql.query("select irate(col1) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col2) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col3) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col4) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col5) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col6) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col11) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col12) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col13) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col14) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col2) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col2) from test1;") + tdSql.checkData(0, 0, 1) + + tdSql.query("select irate(col1) from gtest1;") + tdSql.checkData(0, 0, 1.2/1.1) + tdSql.query("select irate(col1) from gtest2;") + tdSql.checkData(0, 0, 10) + tdSql.query("select irate(col1) from gtest3;") + tdSql.checkData(0, 0, 0) + tdSql.query("select irate(col1) from gtest4;") + tdSql.checkRows(0) + tdSql.query("select irate(col1) from gtest5;") + tdSql.checkData(0, 0, 0) + tdSql.query("select irate(col1) from gtest6;") + tdSql.checkData(0, 0, 2) + tdSql.query("select irate(col1) from gtest7;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col1) from gtest7 interval(5s) order by ts asc;") + tdSql.checkData(1, 1, 4) + tdSql.checkData(2, 1, 0) + tdSql.checkData(3, 1, 1) + tdSql.query("select irate(col1) from gtest7 interval(5s) order by ts desc ;") + tdSql.checkData(1, 1, 0) + tdSql.checkData(2, 1, 4) + tdSql.checkData(3, 1, 0) + + #error + tdSql.error("select irate(col1) from test") + tdSql.error("select irate(ts) from test1") + tdSql.error("select irate(col7) from test1") + tdSql.error("select irate(col8) from test1") + tdSql.error("select irate(col9) from test1") + tdSql.error("select irate(loc) from test1") + tdSql.error("select irate(tag1) from test1") + + # use db1 precision us + tdSql.execute("create database db1 precision 'us' keep 3650 UPDATE 1") + tdSql.execute("use db1 ") + tdSql.execute('''create table test(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 test tags('beijing')") + tdSql.execute("create table gtest1 (ts timestamp, col1 float)") + tdSql.execute("create table gtest2 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest3 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest4 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest5 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest6 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest7 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest8 (ts timestamp, col1 tinyint)") + tdSql.execute("create table gtest9 (ts timestamp, col1 tinyint)") + + 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.ts1 + i*1000000, i + 1, i + 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.execute("insert into gtest1 values(1537146000000000,0);") + tdSql.execute("insert into gtest1 values(1537146001100000,1.2);") + tdSql.execute("insert into gtest2 values(1537146001001000,1);") + tdSql.execute("insert into gtest2 values(1537146001101000,2);") + tdSql.execute("insert into gtest3 values(1537146001101000,2);") + tdSql.execute("insert into gtest4(ts) values(1537146001101000);") + tdSql.execute("insert into gtest5 values(1537146001002000,4);") + tdSql.execute("insert into gtest5 values(1537146002202000,4);") + tdSql.execute("insert into gtest6 values(1537146000000000,5);") + tdSql.execute("insert into gtest6 values(1537146001000000,2);") + tdSql.execute("insert into gtest7 values(1537146001000000,1);") + tdSql.execute("insert into gtest7 values(1537146008000000,2);") + tdSql.execute("insert into gtest7 values(1537146009000000,6);") + tdSql.execute("insert into gtest7 values(1537146012000000,3);") + tdSql.execute("insert into gtest7 values(1537146015000000,3);") + tdSql.execute("insert into gtest7 values(1537146017000000,1);") + tdSql.execute("insert into gtest7 values(1537146019000000,3);") + tdSql.execute("insert into gtest8 values(1537146000002000,3);") + tdSql.execute("insert into gtest8 values(1537146001003000,4);") + tdSql.execute("insert into gtest9 values(1537146000000000,4);") + tdSql.execute("insert into gtest9 values(1537146000000001,5);") + + + # irate verifacation + tdSql.query("select irate(col1) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col1) from test1 interval(10s);") + tdSql.checkData(0, 1, 1) + tdSql.query("select irate(col1) from test1;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col1) from gtest1;") + tdSql.checkData(0, 0, 1.2/1.1) + tdSql.query("select irate(col1) from gtest2;") + tdSql.checkData(0, 0, 10) + tdSql.query("select irate(col1) from gtest3;") + tdSql.checkData(0, 0, 0) + tdSql.query("select irate(col1) from gtest4;") + tdSql.checkRows(0) + tdSql.query("select irate(col1) from gtest5;") + tdSql.checkData(0, 0, 0) + tdSql.query("select irate(col1) from gtest6;") + tdSql.checkData(0, 0, 2) + tdSql.query("select irate(col1) from gtest7;") + tdSql.checkData(0, 0, 1) + tdSql.query("select irate(col1) from gtest7 interval(5s) order by ts asc;") + tdSql.checkData(1, 1, 4) + tdSql.checkData(2, 1, 0) + tdSql.checkData(3, 1, 1) + tdSql.query("select irate(col1) from gtest7 interval(5s) order by ts desc ;") + tdSql.checkData(1, 1, 0) + tdSql.checkData(2, 1, 4) + tdSql.checkData(3, 1, 0) + tdSql.query("select irate(col1) from gtest8;") + tdSql.checkData(0, 0, 1/1.001) + tdSql.query("select irate(col1) from gtest9;") + tdSql.checkData(0, 0, 1000000) + + #error + tdSql.error("select irate(col1) from test") + tdSql.error("select irate(ts) from test1") + tdSql.error("select irate(col7) from test1") + tdSql.error("select irate(col8) from test1") + tdSql.error("select irate(col9) from test1") + tdSql.error("select irate(loc) from test1") + tdSql.error("select irate(tag1) from test1") + + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_operations.py b/tests/pytest/functions/function_operations.py index 859cd78a3d..3e90d1d3ea 100644 --- a/tests/pytest/functions/function_operations.py +++ b/tests/pytest/functions/function_operations.py @@ -16,7 +16,7 @@ import taos from util.log import * from util.cases import * from util.sql import * -import numpy as np +#import numpy as np class TDTestCase: diff --git a/tests/pytest/functions/function_stateWindow.py b/tests/pytest/functions/function_stateWindow.py new file mode 100644 index 0000000000..8f05b32164 --- /dev/null +++ b/tests/pytest/functions/function_stateWindow.py @@ -0,0 +1,109 @@ +################################################################### +# 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 table test(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 test tags('beijing')") + col0 = 0 + 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, col0, i + 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)) + + # operation not allowed on super table + tdSql.error("select count(*) from test session(ts, 1s)") + # operation not allowde on col pro + tdSql.error("select * from test1 session(ts, 1s)") + # operation not allowed on col except primary ts + tdSql.error("select * from test1 session(col1, 1s)") + + tdSql.query("select count(*) from test1 state_window(col1)") + + tdSql.checkRows(1) + tdSql.checkData(0, 0, self.rowNum) + # append more data + + col0 = col0 + 1 + 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 + 10000, col0, i + 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(*) from test1 state_window(col1)") + + tdSql.checkRows(2) + tdSql.checkData(0, 0, self.rowNum) + tdSql.checkData(1, 0, self.rowNum) + + + tdSql.query("select first(col1) from test1 state_window(col1)") + tdSql.checkRows(2) + col0 = col0 - 1 + tdSql.checkData(0, 0, col0) + col0 = col0 + 1 + tdSql.checkData(1, 0, col0) + + tdSql.query("select first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 1) + tdSql.checkData(1, 0, 1) + + tdSql.query("select count(col1), first(col2) from test1 state_window(col1)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 10) + tdSql.checkData(0, 1, 1) + + tdSql.checkData(1, 0, 10) + tdSql.checkData(1, 1, 1) + + + #tdSql.query("select count(*) from test1 session(ts, 1m)") + #tdSql.checkRows(1) + #tdSql.checkData(0, 1, 11) + + #tdSql.query("select first(col1) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(1, 1, 1) + + #tdSql.query("select first(col1), last(col2) from test1 session(ts, 1s)") + #tdSql.checkRows(2) + #tdSql.checkData(0, 1, 1) + #tdSql.checkData(0, 2, 10) + #tdSql.checkData(1, 1, 1) + #tdSql.checkData(1, 1, 1) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/queryTestCases.py b/tests/pytest/functions/queryTestCases.py new file mode 100644 index 0000000000..b7480fdbd5 --- /dev/null +++ b/tests/pytest/functions/queryTestCases.py @@ -0,0 +1,364 @@ +################################################################### +# 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 subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug(f"start to execute {__file__}") + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self) -> str: + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/debug/build/bin")] + break + return buildPath + + def getCfgDir(self) -> str: + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + cfgDir = self.getBuildPath() + "/community/sim/dnode1/cfg" + else: + cfgDir = self.getBuildPath() + "/sim/dnode1/cfg" + return cfgDir + + def getCfgFile(self) -> str: + return self.getCfgDir()+"/taos.cfg" + + def td3690(self): + tdLog.printNoPrefix("==========TD-3690==========") + tdSql.query("show variables") + tdSql.checkData(51, 1, 864000) + + def td4082(self): + tdLog.printNoPrefix("==========TD-4082==========") + cfgfile = self.getCfgFile() + max_compressMsgSize = 100000000 + + tdSql.query("show variables") + tdSql.checkData(26, 1, -1) + + tdSql.query("show dnodes") + index = tdSql.getData(0, 0) + + tdDnodes.stop(index) + cmd = f"sed -i '$a compressMSgSize {max_compressMsgSize}' {cfgfile} " + try: + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + except Exception as e: + raise e + + tdDnodes.start(index) + tdSql.query("show variables") + tdSql.checkData(26, 1, 100000000) + + tdDnodes.stop(index) + cmd = f"sed -i '$s/{max_compressMsgSize}/{max_compressMsgSize+10}/g' {cfgfile} " + try: + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + except Exception as e: + raise e + + tdDnodes.start(index) + tdSql.query("show variables") + tdSql.checkData(26, 1, -1) + + tdDnodes.stop(index) + cmd = f"sed -i '$d' {cfgfile}" + try: + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + except Exception as e: + raise e + + tdDnodes.start(index) + + def td4097(self): + tdLog.printNoPrefix("==========TD-4097==========") + tdSql.execute("drop database if exists db") + tdSql.execute("drop database if exists db1") + tdSql.execute("create database if not exists db keep 3650") + tdSql.execute("create database if not exists db1 keep 3650") + + tdSql.execute("create stable db.stb1 (ts timestamp, c1 int) tags(t1 int)") + tdSql.execute("create stable db.stb2 (ts timestamp, c1 int) tags(t1 int)") + tdSql.execute("create stable db1.stb3 (ts timestamp, c1 int) tags(t1 int)") + + tdSql.execute("create table db.t10 using db.stb1 tags(1)") + tdSql.execute("create table db.t11 using db.stb1 tags(2)") + tdSql.execute("create table db.t20 using db.stb2 tags(3)") + tdSql.execute("create table db1.t30 using db1.stb3 tags(4)") + + tdLog.printNoPrefix("==========TD-4097==========") + # 插入数据,然后进行show create 操作 + + # p1 不进入指定数据库 + tdSql.query("show create database db") + tdSql.checkRows(1) + tdSql.error("show create database ") + tdSql.error("show create databases db ") + tdSql.error("show create database db.stb1") + tdSql.error("show create database db0") + tdSql.error("show create database db db1") + tdSql.error("show create database db, db1") + tdSql.error("show create database stb1") + tdSql.error("show create database * ") + + tdSql.query("show create stable db.stb1") + tdSql.checkRows(1) + tdSql.error("show create stable db.t10") + tdSql.error("show create stable db.stb0") + tdSql.error("show create stable stb1") + tdSql.error("show create stable ") + tdSql.error("show create stable *") + tdSql.error("show create stable db.stb1 db.stb2") + tdSql.error("show create stable db.stb1, db.stb2") + + tdSql.query("show create table db.stb1") + tdSql.checkRows(1) + tdSql.query("show create table db.t10") + tdSql.checkRows(1) + tdSql.error("show create table db.stb0") + tdSql.error("show create table stb1") + tdSql.error("show create table ") + tdSql.error("show create table *") + tdSql.error("show create table db.stb1 db.stb2") + tdSql.error("show create table db.stb1, db.stb2") + + # p2 进入指定数据库 + tdSql.execute("use db") + + tdSql.query("show create database db") + tdSql.checkRows(1) + tdSql.query("show create database db1") + tdSql.checkRows(1) + tdSql.error("show create database ") + tdSql.error("show create databases db ") + tdSql.error("show create database db.stb1") + tdSql.error("show create database db0") + tdSql.error("show create database db db1") + tdSql.error("show create database db, db1") + tdSql.error("show create database stb1") + tdSql.error("show create database * ") + + tdSql.query("show create stable db.stb1") + tdSql.checkRows(1) + tdSql.query("show create stable stb1") + tdSql.checkRows(1) + tdSql.query("show create stable db1.stb3") + tdSql.checkRows(1) + tdSql.error("show create stable db.t10") + tdSql.error("show create stable db") + tdSql.error("show create stable t10") + tdSql.error("show create stable db.stb0") + tdSql.error("show create stables stb1") + tdSql.error("show create stable ") + tdSql.error("show create stable *") + tdSql.error("show create stable db.stb1 db.stb2") + tdSql.error("show create stable stb1 stb2") + tdSql.error("show create stable db.stb1, db.stb2") + tdSql.error("show create stable stb1, stb2") + + tdSql.query("show create table db.stb1") + tdSql.checkRows(1) + tdSql.query("show create table stb1") + tdSql.checkRows(1) + tdSql.query("show create table db.t10") + tdSql.checkRows(1) + tdSql.query("show create table t10") + tdSql.checkRows(1) + tdSql.query("show create table db1.t30") + tdSql.checkRows(1) + tdSql.error("show create table t30") + tdSql.error("show create table db.stb0") + tdSql.error("show create table db.t0") + tdSql.error("show create table db") + tdSql.error("show create tables stb1") + tdSql.error("show create tables t10") + tdSql.error("show create table ") + tdSql.error("show create table *") + tdSql.error("show create table db.stb1 db.stb2") + tdSql.error("show create table db.t11 db.t10") + tdSql.error("show create table db.stb1, db.stb2") + tdSql.error("show create table db.t11, db.t10") + tdSql.error("show create table stb1 stb2") + tdSql.error("show create table t11 t10") + tdSql.error("show create table stb1, stb2") + tdSql.error("show create table t11, t10") + + # p3 删库删表后进行查询 + tdSql.execute("drop table if exists t11") + + tdSql.error("show create table t11") + tdSql.error("show create table db.t11") + tdSql.query("show create stable stb1") + tdSql.checkRows(1) + tdSql.query("show create table t10") + tdSql.checkRows(1) + + tdSql.execute("drop stable if exists stb2") + + tdSql.error("show create table stb2") + tdSql.error("show create table db.stb2") + tdSql.error("show create stable stb2") + tdSql.error("show create stable db.stb2") + tdSql.error("show create stable db.t20") + tdSql.query("show create database db") + tdSql.checkRows(1) + tdSql.query("show create stable db.stb1") + tdSql.checkRows(1) + + tdSql.execute("drop database if exists db1") + tdSql.error("show create database db1") + tdSql.error("show create stable db1.t31") + tdSql.error("show create stable db1.stb3") + tdSql.query("show create database db") + tdSql.checkRows(1) + tdSql.query("show create stable db.stb1") + tdSql.checkRows(1) + + def td4153(self): + tdLog.printNoPrefix("==========TD-4153==========") + + pass + + def td4288(self): + tdLog.printNoPrefix("==========TD-4288==========") + # keep ~ [days,365000] + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + tdSql.query("show variables") + tdSql.checkData(36, 1, 3650) + tdSql.query("show databases") + tdSql.checkData(0,7,"3650,3650,3650") + + days = tdSql.getData(0, 6) + tdSql.error("alter database db keep 3650001") + tdSql.error("alter database db keep 9") + tdSql.error("alter database db keep 0b") + tdSql.error("alter database db keep 3650,9,36500") + tdSql.error("alter database db keep 3650,3650,365001") + tdSql.error("alter database db keep 36500,a,36500") + tdSql.error("alter database db keep (36500,3650,3650)") + tdSql.error("alter database db keep [36500,3650,36500]") + tdSql.error("alter database db keep 36500,0xff,3650") + tdSql.error("alter database db keep 36500,0o365,3650") + tdSql.error("alter database db keep 36500,0A3Ch,3650") + tdSql.error("alter database db keep") + tdSql.error("alter database db keep0 36500") + + tdSql.execute("alter database db keep 36500") + tdSql.query("show databases") + tdSql.checkData(0, 7, "3650,3650,36500") + tdSql.execute("drop database if exists db") + + tdSql.execute("create database if not exists db1") + tdSql.query("show databases") + tdSql.checkData(0, 7, "3650,3650,3650") + tdSql.query("show variables") + tdSql.checkData(36, 1, 3650) + + tdSql.execute("alter database db1 keep 365") + tdSql.execute("drop database if exists db1") + + + pass + + def td4724(self): + tdLog.printNoPrefix("==========TD-4724==========") + cfgfile = self.getCfgFile() + minTablesPerVnode = 5 + maxTablesPerVnode = 10 + maxVgroupsPerDb = 100 + + tdSql.query("show dnodes") + index = tdSql.getData(0, 0) + + tdDnodes.stop(index) + vnode_cmd = f"sed -i '$a maxVgroupsPerDb {maxVgroupsPerDb}' {cfgfile} " + min_cmd = f"sed -i '$a minTablesPerVnode {minTablesPerVnode}' {cfgfile} " + max_cmd = f"sed -i '$a maxTablesPerVnode {maxTablesPerVnode}' {cfgfile} " + try: + _ = subprocess.check_output(vnode_cmd, shell=True).decode("utf-8") + _ = subprocess.check_output(min_cmd, shell=True).decode("utf-8") + _ = subprocess.check_output(max_cmd, shell=True).decode("utf-8") + except Exception as e: + raise e + + tdDnodes.start(index) + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db keep 3650") + tdSql.execute("use db") + tdSql.execute("create stable db.stb1 (ts timestamp, c1 int) tags(t1 int)") + insert_sql = "insert into " + for i in range(100): + tdSql.execute(f"create table db.t1{i} using db.stb1 tags({i})") + insert_sql += f" t1{i} values({1604298064000 + i*1000}, {i})" + tdSql.query("show dnodes") + vnode_count = tdSql.getData(0, 2) + if vnode_count <= 1: + tdLog.exit("vnode is less than 2") + + tdSql.execute(insert_sql) + tdDnodes.stop(index) + cmd = f"sed -i '$d' {cfgfile}" + try: + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + _ = subprocess.check_output(cmd, shell=True).decode("utf-8") + except Exception as e: + raise e + + tdDnodes.start(index) + + pass + + def run(self): + + # master branch + # self.td3690() + # self.td4082() + # self.td4288() + self.td4724() + + # develop branch + # self.td4097() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) + + + diff --git a/tests/pytest/functions/showOfflineThresholdIs864000.py b/tests/pytest/functions/showOfflineThresholdIs864000.py index 6cce869bf2..a7a1c2bf3f 100644 --- a/tests/pytest/functions/showOfflineThresholdIs864000.py +++ b/tests/pytest/functions/showOfflineThresholdIs864000.py @@ -25,7 +25,7 @@ class TDTestCase: def run(self): tdSql.query("show variables") - tdSql.checkData(51, 1, 864000) + tdSql.checkData(53, 1, 864000) def stop(self): tdSql.close() @@ -33,4 +33,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index 0d583aa2cc..0cbb7876c6 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -4,6 +4,8 @@ import sys from util.log import * from util.cases import * from util.sql import * +import subprocess +import os class TDTestCase: @@ -50,6 +52,10 @@ class TDTestCase: tdLog.info('==> $data00') tdLog.info("tdSql.checkData(0, 0, '34567')") tdSql.checkData(0, 0, '34567') + tdLog.info("insert into tb values (now+4a, \"'';\")") + config_dir = subprocess.check_output(str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"), stderr=subprocess.STDOUT, shell=True).decode('utf-8').replace('\n', '') + result = ''.join(os.popen(r"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""%(config_dir)).readlines()) + if "Query OK" not in result: tdLog.exit("err:insert '';") tdLog.info('drop database db') tdSql.execute('drop database db') tdLog.info('show databases') diff --git a/tests/pytest/insert/in_function.py b/tests/pytest/insert/in_function.py new file mode 100644 index 0000000000..3f2e1a03ca --- /dev/null +++ b/tests/pytest/insert/in_function.py @@ -0,0 +1,1114 @@ +################################################################### +# 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 datetime + +from util.log import * +from util.cases import * +from util.sql import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-4568 + # test case for https://jira.taosdata.com:18080/browse/TD-4824 + + tdLog.info("=============== step1,check bool and tinyint data type") + + tdLog.info("=============== step1.1,drop table && create table") + cmd1 = 'drop table if exists in_bool_tinyint_1 ;' + cmd2 = 'drop table if exists in_bool_tinyint_2 ;' + cmd3 = 'drop table if exists in_bool_tinyint_3 ;' + cmd10 = 'drop table if exists in_stable_1 ;' + cmd11 = 'create stable in_stable_1(ts timestamp,in_bool bool,in_tinyint tinyint) tags (tin_bool bool,tin_tinyint tinyint) ;' + cmd12 = 'create table in_bool_tinyint_1 using in_stable_1 tags(\'true\',\'127\') ; ' + cmd13 = 'create table in_bool_tinyint_2 using in_stable_1 tags(\'false\',\'-127\') ; ' + cmd14 = 'create table in_bool_tinyint_3 using in_stable_1 tags(\'false\',\'0\') ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd10) + tdSql.execute(cmd10) + tdLog.info(cmd11) + tdSql.execute(cmd11) + tdLog.info(cmd12) + tdSql.execute(cmd12) + tdLog.info(cmd13) + tdSql.execute(cmd13) + tdLog.info(cmd14) + tdSql.execute(cmd14) + + tdLog.info("=============== step1.2,insert stable right data and check in function") + cmd1 = 'insert into in_bool_tinyint_1 values(now,\'true\',\'-127\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from in_stable_1 where in_bool in (true) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.checkData(0,3,'True') + tdSql.checkData(0,4,'127') + tdSql.query('select * from in_stable_1 where in_tinyint in (-127) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.checkData(0,3,'True') + tdSql.checkData(0,4,'127') + tdSql.query('select * from in_stable_1 where tin_bool in (true) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.checkData(0,3,'True') + tdSql.checkData(0,4,'127') + tdSql.query('select * from in_stable_1 where tin_tinyint in (127) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.checkData(0,3,'True') + tdSql.checkData(0,4,'127') + tdSql.query('select * from in_bool_tinyint_1 where in_bool in (true) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.query('select * from in_bool_tinyint_1 where in_tinyint in (-127) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + + cmd2 = 'insert into in_bool_tinyint_2 values(now,\'false\',\'127\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from in_stable_1 where in_bool in (false) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'-127') + tdSql.query('select * from in_stable_1 where in_tinyint in (127) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'-127') + tdSql.query('select * from in_stable_1 where tin_bool in (false) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'-127') + tdSql.query('select * from in_stable_1 where tin_tinyint in (-127) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'-127') + tdSql.query('select * from in_bool_tinyint_2 where in_bool in (false) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.query('select * from in_bool_tinyint_2 where in_tinyint in (127) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + + cmd3 = 'insert into in_bool_tinyint_3 values(now,\'true\',\'0\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from in_stable_1 where in_tinyint in (0) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_stable_1 where tin_tinyint in (0) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_bool_tinyint_3 where in_bool in (true) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + tdSql.query('select * from in_bool_tinyint_3 where in_tinyint in (0) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + + tdLog.info("=============== step1.3,multiple column and multiple tag check in function") + cmd1 = '''select * from in_stable_1 + where in_bool in (true,false) and in_tinyint in (0,127,-127) + and tin_bool in (true,false) and tin_tinyint in (0,127,-127) + order by ts desc ;''' + tdLog.info(cmd1) + tdSql.query(cmd1) + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'False') + tdSql.checkData(0,4,'0') + tdSql.checkData(1,1,'False') + tdSql.checkData(1,2,'127') + tdSql.checkData(1,3,'False') + tdSql.checkData(1,4,'-127') + tdSql.checkData(2,1,'True') + tdSql.checkData(2,2,'-127') + tdSql.checkData(2,3,'True') + tdSql.checkData(2,4,'127') + + + tdLog.info("=============== step1.4,drop normal table && create table") + cmd1 = 'drop table if exists normal_in_bool_tinyint_1 ;' + cmd2 = 'create table normal_in_bool_tinyint_1 (ts timestamp,in_bool bool,in_tinyint tinyint) ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + + + tdLog.info("=============== step1.5,insert normal table right data and check in function") + cmd1 = 'insert into normal_in_bool_tinyint_1 values(now,\'true\',\'-127\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from normal_in_bool_tinyint_1 where in_bool in (true) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + tdSql.query('select * from normal_in_bool_tinyint_1 where in_tinyint in (-127) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'-127') + + cmd2 = 'insert into normal_in_bool_tinyint_1 values(now,\'false\',\'127\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from normal_in_bool_tinyint_1 where in_bool in (false) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + tdSql.query('select * from normal_in_bool_tinyint_1 where in_tinyint in (127) order by ts desc') + tdSql.checkData(0,1,'False') + tdSql.checkData(0,2,'127') + + cmd3 = 'insert into normal_in_bool_tinyint_1 values(now,\'true\',\'0\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from normal_in_bool_tinyint_1 where in_tinyint in (0) order by ts desc') + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + + cmd4 = '''select * from normal_in_bool_tinyint_1 + where in_bool in (true,false) and in_tinyint in (0,127,-127) + order by ts desc ;''' + tdLog.info(cmd4) + tdSql.query(cmd4) + tdSql.checkData(0,1,'True') + tdSql.checkData(0,2,'0') + tdSql.checkData(1,1,'False') + tdSql.checkData(1,2,'127') + tdSql.checkData(2,1,'True') + tdSql.checkData(2,2,'-127') + + + tdLog.info("=============== step2,check int、smallint and bigint data type") + + tdLog.info("=============== step2.1,drop table && create table") + cmd1 = 'drop table if exists in_int_smallint_bigint_1 ;' + cmd2 = 'drop table if exists in_int_smallint_bigint_2 ;' + cmd3 = 'drop table if exists in_int_smallint_bigint_3 ;' + cmd10 = 'drop table if exists in_stable_2 ;' + cmd11 = 'create stable in_stable_2(ts timestamp,in_int int,in_small smallint , in_big bigint) tags (tin_int int,tin_small smallint , tin_big bigint) ;' + cmd12 = 'create table in_int_smallint_bigint_1 using in_stable_2 tags(\'2147483647\',\'-32767\',\'0\') ; ' + cmd13 = 'create table in_int_smallint_bigint_2 using in_stable_2 tags(\'-2147483647\',\'0\',\'9223372036854775807\') ; ' + cmd14 = 'create table in_int_smallint_bigint_3 using in_stable_2 tags(\'0\',\'32767\',\'-9223372036854775807\') ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd10) + tdSql.execute(cmd10) + tdLog.info(cmd11) + tdSql.execute(cmd11) + tdLog.info(cmd12) + tdSql.execute(cmd12) + tdLog.info(cmd13) + tdSql.execute(cmd13) + tdLog.info(cmd14) + tdSql.execute(cmd14) + + tdLog.info("=============== step2.2,insert stable right data and check in function") + cmd1 = 'insert into in_int_smallint_bigint_1 values(now,\'2147483647\',\'-32767\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from in_stable_2 where in_int in (2147483647) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_stable_2 where in_small in (-32767) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_stable_2 where in_big in (0) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_stable_2 where tin_int in (2147483647) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_stable_2 where tin_small in (-32767) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_stable_2 where tin_big in (0) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'2147483647') + tdSql.checkData(0,5,'-32767') + tdSql.checkData(0,6,'0') + tdSql.query('select * from in_int_smallint_bigint_1 where in_int in (2147483647) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.query('select * from in_int_smallint_bigint_1 where in_small in (-32767) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.query('select * from in_int_smallint_bigint_1 where in_big in (0) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + + cmd2 = 'insert into in_int_smallint_bigint_2 values(now,\'-2147483647\',\'0\',\'9223372036854775807\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from in_stable_2 where in_int in (-2147483647) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_stable_2 where in_small in (0) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_stable_2 where in_big in (9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_int in (-2147483647) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_small in (0) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_big in (9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.checkData(0,4,'-2147483647') + tdSql.checkData(0,5,'0') + tdSql.checkData(0,6,'9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_2 where in_int in (-2147483647) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_2 where in_small in (0) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_2 where in_big in (9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + + cmd3 = 'insert into in_int_smallint_bigint_3 values(now,\'0\',\'32767\',\'-9223372036854775807\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from in_stable_2 where in_int in (0) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_stable_2 where in_small in (32767) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_stable_2 where in_big in (-9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_int in (0) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_small in (32767) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_stable_2 where tin_big in (-9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_3 where in_int in (0) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_3 where in_small in (32767) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.query('select * from in_int_smallint_bigint_3 where in_big in (-9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + + + tdLog.info("=============== step2.3,multiple column and multiple tag check in function") + cmd1 = '''select * from in_stable_2 + where in_int in (0,2147483647,-2147483647) and in_small in (0,32767,-32767) + and in_big in (0,9223372036854775807,-9223372036854775807) + and tin_int in (0,2147483647,-2147483647) and tin_small in (0,32767,-32767) + and tin_big in (0,9223372036854775807,-9223372036854775807) + order by ts desc ;''' + tdLog.info(cmd1) + tdSql.query(cmd1) + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(0,4,'0') + tdSql.checkData(0,5,'32767') + tdSql.checkData(0,6,'-9223372036854775807') + tdSql.checkData(1,1,'-2147483647') + tdSql.checkData(1,2,'0') + tdSql.checkData(1,3,'9223372036854775807') + tdSql.checkData(1,4,'-2147483647') + tdSql.checkData(1,5,'0') + tdSql.checkData(1,6,'9223372036854775807') + tdSql.checkData(2,1,'2147483647') + tdSql.checkData(2,2,'-32767') + tdSql.checkData(2,3,'0') + tdSql.checkData(2,4,'2147483647') + tdSql.checkData(2,5,'-32767') + tdSql.checkData(2,6,'0') + + + tdLog.info("=============== step2.4,drop normal table && create table") + cmd1 = 'drop table if exists normal_int_smallint_bigint_1 ;' + cmd2 = 'create table normal_int_smallint_bigint_1 (ts timestamp,in_int int,in_small smallint , in_big bigint) ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + + + tdLog.info("=============== step2.5,insert normal table right data and check in function") + cmd1 = 'insert into normal_int_smallint_bigint_1 values(now,\'2147483647\',\'-32767\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from normal_int_smallint_bigint_1 where in_int in (2147483647) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_small in (-32767) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_big in (0) order by ts desc') + tdSql.checkData(0,1,'2147483647') + tdSql.checkData(0,2,'-32767') + tdSql.checkData(0,3,'0') + + cmd2 = 'insert into normal_int_smallint_bigint_1 values(now,\'-2147483647\',\'0\',\'9223372036854775807\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from normal_int_smallint_bigint_1 where in_int in (-2147483647) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_small in (0) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_big in (9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'-2147483647') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'9223372036854775807') + + cmd3 = 'insert into normal_int_smallint_bigint_1 values(now,\'0\',\'32767\',\'-9223372036854775807\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from normal_int_smallint_bigint_1 where in_int in (0) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_small in (32767) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.query('select * from normal_int_smallint_bigint_1 where in_big in (-9223372036854775807) order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + + cmd4 = '''select * from normal_int_smallint_bigint_1 + where in_int in (0,2147483647,-2147483647) and in_small in (0,32767,-32767) + and in_big in (0,9223372036854775807,-9223372036854775807) + order by ts desc ;''' + tdLog.info(cmd4) + tdSql.query(cmd4) + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'32767') + tdSql.checkData(0,3,'-9223372036854775807') + tdSql.checkData(1,1,'-2147483647') + tdSql.checkData(1,2,'0') + tdSql.checkData(1,3,'9223372036854775807') + tdSql.checkData(2,1,'2147483647') + tdSql.checkData(2,2,'-32767') + tdSql.checkData(2,3,'0') + + + tdLog.info("=============== step3,check binary and nchar data type") + + tdLog.info("=============== step3.1,drop table && create table") + cmd1 = 'drop table if exists in_binary_nchar_1 ;' + cmd2 = 'drop table if exists in_binary_nchar_2 ;' + cmd3 = 'drop table if exists in_binary_nchar_3 ;' + cmd10 = 'drop table if exists in_stable_3 ;' + cmd11 = 'create stable in_stable_3(ts timestamp,in_binary binary(8),in_nchar nchar(12)) tags (tin_binary binary(16),tin_nchar nchar(20)) ;' + cmd12 = 'create table in_binary_nchar_1 using in_stable_3 tags(\'0\',\'0\') ; ' + cmd13 = 'create table in_binary_nchar_2 using in_stable_3 tags(\'TDengine\',\'北京涛思数据科技有限公司\') ; ' + cmd14 = 'create table in_binary_nchar_3 using in_stable_3 tags(\'taosdataTDengine\',\'北京涛思数据科技有限公司TDengine\') ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd10) + tdSql.execute(cmd10) + tdLog.info(cmd11) + tdSql.execute(cmd11) + tdLog.info(cmd12) + tdSql.execute(cmd12) + tdLog.info(cmd13) + tdSql.execute(cmd13) + tdLog.info(cmd14) + tdSql.execute(cmd14) + + tdLog.info("=============== step3.2,insert stable right data and check in function") + cmd1 = 'insert into in_binary_nchar_1 values(now,\'0\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from in_stable_3 where in_binary in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_stable_3 where in_nchar in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_stable_3 where tin_binary in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_stable_3 where tin_nchar in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.checkData(0,3,'0') + tdSql.checkData(0,4,'0') + tdSql.query('select * from in_binary_nchar_1 where in_binary in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.query('select * from in_binary_nchar_1 where in_nchar in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + + cmd2 = 'insert into in_binary_nchar_2 values(now,\'TAOS\',\'涛思数据TAOSdata\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from in_stable_3 where in_binary in (\'TAOS\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.checkData(0,3,'TDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司') + tdSql.query('select * from in_stable_3 where in_nchar in (\'涛思数据TAOSdata\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.checkData(0,3,'TDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司') + tdSql.query('select * from in_stable_3 where tin_binary in (\'TDengine\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.checkData(0,3,'TDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司') + tdSql.query('select * from in_stable_3 where tin_nchar in (\'北京涛思数据科技有限公司\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.checkData(0,3,'TDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司') + tdSql.query('select * from in_binary_nchar_2 where in_binary in (\'TAOS\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.query('select * from in_binary_nchar_2 where in_nchar in (\'涛思数据TAOSdata\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + + cmd3 = 'insert into in_binary_nchar_3 values(now,\'TDengine\',\'北京涛思数据科技有限公司\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from in_stable_3 where in_binary in (\'TDengine\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(0,3,'taosdataTDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine') + tdSql.query('select * from in_stable_3 where in_nchar in (\'北京涛思数据科技有限公司\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(0,3,'taosdataTDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine') + tdSql.query('select * from in_stable_3 where tin_binary in (\'taosdataTDengine\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(0,3,'taosdataTDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine') + tdSql.query('select * from in_stable_3 where tin_nchar in (\'北京涛思数据科技有限公司TDengine\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(0,3,'taosdataTDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine') + tdSql.query('select * from in_binary_nchar_3 where in_binary in (\'TDengine\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.query('select * from in_binary_nchar_3 where in_nchar in (\'北京涛思数据科技有限公司\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + + + tdLog.info("=============== step3.3,multiple column and multiple tag check in function") + cmd1 = '''select * from in_stable_3 + where in_binary in (\'0\',\'TDengine\',\'TAOS\') + and in_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'涛思数据TAOSdata\') + and tin_binary in (\'0\',\'TDengine\',\'taosdataTDengine\') + and tin_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'北京涛思数据科技有限公司TDengine\') + order by ts desc ;''' + tdLog.info(cmd1) + tdSql.query(cmd1) + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(0,3,'taosdataTDengine') + tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine') + tdSql.checkData(1,1,'TAOS') + tdSql.checkData(1,2,'涛思数据TAOSdata') + tdSql.checkData(1,3,'TDengine') + tdSql.checkData(1,4,'北京涛思数据科技有限公司') + tdSql.checkData(2,1,'0') + tdSql.checkData(2,2,'0') + tdSql.checkData(2,3,'0') + tdSql.checkData(2,4,'0') + + + tdLog.info("=============== step3.4,drop normal table && create table") + cmd1 = 'drop table if exists normal_in_binary_nchar_1 ;' + cmd2 = 'create table normal_in_binary_nchar_1 (ts timestamp,in_binary binary(8),in_nchar nchar(12)) ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + + + tdLog.info("=============== step3.5,insert normal table right data and check in function") + cmd1 = 'insert into normal_in_binary_nchar_1 values(now,\'0\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from normal_in_binary_nchar_1 where in_binary in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + tdSql.query('select * from normal_in_binary_nchar_1 where in_nchar in (\'0\') order by ts desc') + tdSql.checkData(0,1,'0') + tdSql.checkData(0,2,'0') + + cmd2 = 'insert into normal_in_binary_nchar_1 values(now,\'TAOS\',\'涛思数据TAOSdata\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from normal_in_binary_nchar_1 where in_binary in (\'TAOS\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + tdSql.query('select * from normal_in_binary_nchar_1 where in_nchar in (\'涛思数据TAOSdata\') order by ts desc') + tdSql.checkData(0,1,'TAOS') + tdSql.checkData(0,2,'涛思数据TAOSdata') + + cmd3 = 'insert into normal_in_binary_nchar_1 values(now,\'TDengine\',\'北京涛思数据科技有限公司\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdSql.query('select * from normal_in_binary_nchar_1 where in_binary in (\'TDengine\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.query('select * from normal_in_binary_nchar_1 where in_nchar in (\'北京涛思数据科技有限公司\') order by ts desc') + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + + cmd4 = '''select * from normal_in_binary_nchar_1 + where in_binary in (\'0\',\'TDengine\',\'TAOS\') + and in_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'涛思数据TAOSdata\') + order by ts desc ;''' + tdLog.info(cmd4) + tdSql.query(cmd4) + tdSql.checkData(0,1,'TDengine') + tdSql.checkData(0,2,'北京涛思数据科技有限公司') + tdSql.checkData(1,1,'TAOS') + tdSql.checkData(1,2,'涛思数据TAOSdata') + tdSql.checkData(2,1,'0') + tdSql.checkData(2,2,'0') + + + tdLog.info("=============== step4,check float and double data type") + + tdLog.info("=============== step4.1,drop table && create table") + cmd1 = 'drop table if exists in_ts_float_double_1 ;' + cmd2 = 'drop table if exists in_ts_float_double_2 ;' + cmd3 = 'drop table if exists in_ts_float_double_3 ;' + cmd10 = 'drop table if exists in_stable_4 ;' + cmd11 = 'create stable in_stable_4(ts timestamp,in_ts timestamp,in_float float,in_double double) tags (tin_ts timestamp,tin_float float,tin_double double) ;' + cmd12 = 'create table in_ts_float_double_1 using in_stable_4 tags(\'0\',\'0\',\'0\') ; ' + cmd13 = 'create table in_ts_float_double_2 using in_stable_4 tags(\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ; ' + cmd14 = 'create table in_ts_float_double_3 using in_stable_4 tags(\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd10) + tdSql.execute(cmd10) + tdLog.info(cmd11) + tdSql.execute(cmd11) + tdLog.info(cmd12) + tdSql.execute(cmd12) + tdLog.info(cmd13) + tdSql.execute(cmd13) + tdLog.info(cmd14) + tdSql.execute(cmd14) + + tdLog.info("=============== step4.2,insert stable right data and check in function") + cmd1 = 'insert into in_ts_float_double_1 values(now,\'0\',\'0\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + + tdSql.query('select * from in_stable_4 where in_ts in (\'0\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where in_float in (0.00000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where in_double in (0.000000000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + + tdSql.query('select * from in_stable_4 where tin_ts in (\'0\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where tin_ts in (\'1970-01-01 08:00:00.000\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where tin_float in (0.00000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + tdSql.query('select * from in_stable_4 where tin_double in (0.000000000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.checkData(0,4,'1970-01-01 08:00:00.000') + tdSql.checkData(0,5,0.00000) + tdSql.checkData(0,6,0.000000000) + + tdSql.query('select * from in_ts_float_double_1 where in_ts in (\'0\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from in_ts_float_double_1 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from in_ts_float_double_1 where in_float in (0.00000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from in_ts_float_double_1 where in_double in (0.000000000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + + cmd2 = 'insert into in_ts_float_double_2 values(now,\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + + tdSql.query('select * from in_stable_4 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where in_ts in (\'1577836800001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where in_float in (666.00000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where in_double in (-88888.000000000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + + tdSql.query('select * from in_stable_4 where tin_ts in (\'2020-01-01 08:00:00.001000\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where tin_ts in (\'1577836800001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where tin_float in (666.00000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + tdSql.query('select * from in_stable_4 where tin_double in (-88888.000000000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.checkData(0,4,'2020-01-01 08:00:00.001') + tdSql.checkData(0,5,666.00000) + tdSql.checkData(0,6,-88888.000000000) + + tdSql.query('select * from in_ts_float_double_2 where in_ts in (\'1577836800001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from in_ts_float_double_2 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from in_ts_float_double_2 where in_float in (666.00000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from in_ts_float_double_2 where in_double in (-88888.000000000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + + cmd3 = 'insert into in_ts_float_double_3 values(now,\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + + tdSql.query('select * from in_stable_4 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where in_ts in (\'1609459200001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where in_float in (-888.00000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where in_double in (66666.000000000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + + tdSql.query('select * from in_stable_4 where tin_ts in (\'2021-01-01 08:00:00.001000\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where tin_ts in (\'1609459200001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where tin_float in (-888.00000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.query('select * from in_stable_4 where tin_double in (66666.000000000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + + tdSql.query('select * from in_ts_float_double_3 where in_ts in (\'1609459200001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from in_ts_float_double_3 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from in_ts_float_double_3 where in_float in (-888.00000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from in_ts_float_double_3 where in_double in (66666.000000000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + + + tdLog.info("=============== step4.3,multiple column and multiple tag check in function") + cmd1 = '''select * from in_stable_4 + where in_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\') + and in_float in (0.00000,666.00000,-888.00000) + and in_double in (0.000000000,66666.000000000,-88888.000000000) + and tin_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\') + and tin_float in (0.00000,666.00000,-888.00000) + and tin_double in (0.000000000,66666.000000000,-88888.000000000) + order by ts desc ;''' + tdLog.info(cmd1) + tdSql.query(cmd1) + tdSql.checkData(0,1,'2021-01-01 08:00:00.001000') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(0,4,'2021-01-01 08:00:00.001') + tdSql.checkData(0,5,-888.00000) + tdSql.checkData(0,6,66666.000000000) + tdSql.checkData(1,1,'2020-01-01 08:00:00.001000') + tdSql.checkData(1,2,666.00000) + tdSql.checkData(1,3,-88888.000000000) + tdSql.checkData(1,4,'2020-01-01 08:00:00.001') + tdSql.checkData(1,5,666.00000) + tdSql.checkData(1,6,-88888.000000000) + tdSql.checkData(2,1,'1970-01-01 08:00:00.000') + tdSql.checkData(2,2,0.00000) + tdSql.checkData(2,3,0.000000000) + tdSql.checkData(2,4,'1970-01-01 08:00:00.000') + tdSql.checkData(2,5,0.00000) + tdSql.checkData(2,6,0.000000000) + + + + + tdLog.info("=============== step4.4,drop normal table && create table") + cmd1 = 'drop table if exists normal_in_ts_float_double_1 ;' + cmd2 = 'create table normal_in_ts_float_double_1 (ts timestamp,in_ts timestamp,in_float float,in_double double) ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + + + tdLog.info("=============== step4.5,insert normal table right data and check in function") + cmd1 = 'insert into normal_in_ts_float_double_1 values(now,\'0\',\'0\',\'0\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'0\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (0.00000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (0.000000000) order by ts desc') + tdSql.checkData(0,1,'1970-01-01 08:00:00.000') + tdSql.checkData(0,2,0.00000) + tdSql.checkData(0,3,0.000000000) + + cmd2 = 'insert into normal_in_ts_float_double_1 values(now,\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1577836800001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (666.00000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (-88888.000000000) order by ts desc') + tdSql.checkData(0,1,'2020-01-01 08:00:00.001') + tdSql.checkData(0,2,666.00000) + tdSql.checkData(0,3,-88888.000000000) + + cmd3 = 'insert into normal_in_ts_float_double_1 values(now,\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1609459200001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (-888.00000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (66666.000000000) order by ts desc') + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + + cmd4 = '''select * from normal_in_ts_float_double_1 + where in_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\') + and in_double in (0.000000000,66666.000000000,-88888.000000000) + and in_float in (0.00000,666.00000,-888.00000) + order by ts desc ;''' + tdLog.info(cmd4) + tdSql.query(cmd4) + tdSql.checkData(0,1,'2021-01-01 08:00:00.001') + tdSql.checkData(0,2,-888.00000) + tdSql.checkData(0,3,66666.000000000) + tdSql.checkData(1,1,'2020-01-01 08:00:00.001') + tdSql.checkData(1,2,666.00000) + tdSql.checkData(1,3,-88888.000000000) + tdSql.checkData(2,1,'1970-01-01 08:00:00.000') + tdSql.checkData(2,2,0.00000) + tdSql.checkData(2,3,0.000000000) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/insertFromCSVOurofOrder.py b/tests/pytest/insert/insertFromCSV.py similarity index 59% rename from tests/pytest/insert/insertFromCSVOurofOrder.py rename to tests/pytest/insert/insertFromCSV.py index d4de85b7e9..c5d3648569 100644 --- a/tests/pytest/insert/insertFromCSVOurofOrder.py +++ b/tests/pytest/insert/insertFromCSV.py @@ -28,16 +28,15 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - self.ts = 1500074556514 + self.ts = 1500074556514 + self.csvfile = "/tmp/csvfile.csv" + self.rows = 100000 def writeCSV(self): - with open('test3.csv','w', encoding='utf-8', newline='') as csvFile: + with open(self.csvfile, 'w', encoding='utf-8', newline='') as csvFile: writer = csv.writer(csvFile, dialect='excel') - for i in range(1000000): - newTimestamp = self.ts + random.randint(10000000, 10000000000) + random.randint(1000, 10000000) + random.randint(1, 1000) - d = datetime.datetime.fromtimestamp(newTimestamp / 1000) - dt = str(d.strftime("%Y-%m-%d %H:%M:%S.%f")) - writer.writerow(["'%s'" % dt, random.randint(1, 100), random.uniform(1, 100), random.randint(1, 100), random.randint(1, 100)]) + for i in range(self.rows): + writer.writerow([self.ts + i, random.randint(1, 100), random.uniform(1, 100), random.randint(1, 100), random.randint(1, 100)]) def removCSVHeader(self): data = pd.read_csv("ordered.csv") @@ -45,23 +44,25 @@ class TDTestCase: data.to_csv("ordered.csv", header = False, index = False) def run(self): + self.writeCSV() + tdSql.prepare() - tdSql.execute("create table t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)") startTime = time.time() - tdSql.execute("insert into t1 file 'outoforder.csv'") + tdSql.execute("insert into t1 file '%s'" % self.csvfile) duration = time.time() - startTime - print("Out of Order - Insert time: %d" % duration) - tdSql.query("select count(*) from t1") - rows = tdSql.getData(0, 0) + print("Insert time: %d" % duration) + tdSql.query("select * from t1") + tdSql.checkRows(self.rows) - tdSql.execute("create table t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)") - startTime = time.time() - tdSql.execute("insert into t2 file 'ordered.csv'") - duration = time.time() - startTime - print("Ordered - Insert time: %d" % duration) - tdSql.query("select count(*) from t2") - tdSql.checkData(0,0, rows) + tdSql.execute("create table stb(ts timestamp, c1 int, c2 float, c3 int, c4 int) tags(t1 int, t2 binary(20))") + tdSql.execute("insert into t2 using stb(t1) tags(1) file '%s'" % self.csvfile) + tdSql.query("select * from stb") + tdSql.checkRows(self.rows) + + tdSql.execute("insert into t3 using stb tags(1, 'test') file '%s'" % self.csvfile) + tdSql.query("select * from stb") + tdSql.checkRows(self.rows * 2) def stop(self): tdSql.close() diff --git a/tests/pytest/insert/modify_column.py b/tests/pytest/insert/modify_column.py new file mode 100644 index 0000000000..3632eb817a --- /dev/null +++ b/tests/pytest/insert/modify_column.py @@ -0,0 +1,382 @@ +################################################################### +# 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 datetime + +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-4541 + + tdLog.info("=============== step1,check normal table") + + tdLog.info("=============== step1.1,drop table && create table") + cmd1 = 'drop table if exists length11 ;' + cmd2 = 'create table length11 (ts timestamp,lengthbia binary(10),lengthnchar nchar(20));' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + + tdLog.info("=============== step1.2,insert table right data") + cmd1 = 'insert into length11 values(now,\'aaaaaaaaaa\',\'bbbbbbbbbbbbbbbbbbbb\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from length11 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + tdLog.info("=============== step1.3,insert table wrong data") + cmd1 = 'insert into length11 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("string data overflow") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("insert wrong data error catched") + tdSql.query('select * from length11 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + tdLog.info("=============== step1.4,modify columu length ") + cmd1 = 'alter table length11 modify column lengthbia binary(10) ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd2 = 'alter table length11 modify column lengthnchar nchar(20);' + tdLog.info(cmd2) + tdSql.error(cmd2) + try: + tdSql.execute(cmd2) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd3 = 'alter table length11 modify column lengthbia binary(11) ;' + cmd4 = 'describe length11 ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd4) + tdSql.execute(cmd4) + tdSql.query('describe length11 ;') + tdSql.checkData(1,2,11) + + cmd5 = 'alter table length11 modify column lengthnchar nchar(21);' + cmd6 = 'describe length11 ;' + tdLog.info(cmd5) + tdSql.execute(cmd5) + tdLog.info(cmd6) + tdSql.execute(cmd6) + tdSql.query('describe length11 ;') + tdSql.checkData(2,2,21) + + tdSql.query('select * from length11 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + + tdLog.info("=============== step1.5,insert table right data") + cmd1 = 'insert into length11 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from length11 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + + + + + tdLog.info("=============== step2,check stable table and tag") + + tdLog.info("=============== step2.1,drop table && create table") + cmd1 = 'drop table if exists length1 ;' + cmd2 = 'drop table if exists length2 ;' + cmd3 = 'drop table if exists length2 ;' + cmd4 = 'drop table if exists lengthsta1 ;' + cmd5 = 'create stable lengthsta1(ts timestamp,lengthbia binary(10),lengthnchar nchar(20)) tags (tlengthbia binary(15),tlengthnchar nchar(25)) ;' + cmd6 = 'create table length1 using lengthsta1 tags(\'aaaaabbbbbaaaaa\',\'bbbbbaaaaabbbbbaaaaabbbbb\') ; ' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd4) + tdSql.execute(cmd4) + tdLog.info(cmd5) + tdSql.execute(cmd5) + tdLog.info(cmd6) + tdSql.execute(cmd6) + + tdLog.info("=============== step2.2,insert table right data") + cmd1 = 'insert into length1 values(now,\'aaaaaaaaaa\',\'bbbbbbbbbbbbbbbbbbbb\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from length1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + tdLog.info("=============== step2.3,insert table wrong data") + cmd1 = 'insert into length1 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("string data overflow") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("insert wrong data error catched") + tdSql.query('select * from length1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + tdLog.info("=============== step2.4,modify columu length ") + cmd0 = 'alter table length1 modify column lengthbia binary(10) ;' + tdLog.info(cmd0) + tdSql.error(cmd0) + try: + tdSql.execute(cmd1) + tdLog.exit("invalid operation: column can only be modified by super table") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("invalid operation: column can only be modified by super table") + + cmd1 = 'alter table lengthsta1 modify column lengthbia binary(10) ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd2 = 'alter table lengthsta1 modify column lengthnchar nchar(20);' + tdLog.info(cmd2) + tdSql.error(cmd2) + try: + tdSql.execute(cmd2) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd3 = 'alter table lengthsta1 modify column lengthbia binary(11) ;' + cmd4 = 'describe lengthsta1 ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd4) + tdSql.execute(cmd4) + tdSql.query('describe length1 ;') + tdSql.checkData(1,2,11) + + cmd5 = 'alter table lengthsta1 modify column lengthnchar nchar(21);' + cmd6 = 'describe lengthsta1 ;' + tdLog.info(cmd5) + tdSql.execute(cmd5) + tdLog.info(cmd6) + tdSql.execute(cmd6) + tdSql.query('describe lengthsta1 ;') + tdSql.checkData(2,2,21) + + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb') + + + tdLog.info("=============== step2.5,insert table right data") + cmd1 = 'insert into length1 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('select * from length1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + + + + tdLog.info("=============== step2.6,create table wrong tag") + cmd1 = 'create table length2 using lengthsta1 tags(\'aaaaabbbbbaaaaa1\',\'bbbbbaaaaabbbbbaaaaabbbbb1\') ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("invalid operation: tag value too long") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("invalid operation: tag value too long") + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + + tdLog.info("=============== step2.7,modify tag columu length ") + cmd1 = 'alter table lengthsta1 modify tag tlengthbia binary(15) ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd2 = 'alter table lengthsta1 modify tag tlengthnchar nchar(25);' + tdLog.info(cmd2) + tdSql.error(cmd2) + try: + tdSql.execute(cmd2) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd3 = 'alter table lengthsta1 modify tag tlengthbia binary(16) ;' + cmd4 = 'describe lengthsta1 ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd4) + tdSql.execute(cmd4) + tdSql.query('describe lengthsta1 ;') + tdSql.checkData(3,2,16) + + cmd5 = 'alter table lengthsta1 modify tag tlengthnchar nchar(26);' + cmd6 = 'describe lengthsta1 ;' + tdLog.info(cmd5) + tdSql.execute(cmd5) + tdLog.info(cmd6) + tdSql.execute(cmd6) + tdSql.query('describe lengthsta1 ;') + tdSql.checkData(4,2,26) + + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.checkData(0,3,'aaaaabbbbbaaaaa') + tdSql.checkData(0,4,'bbbbbaaaaabbbbbaaaaabbbbb') + + + tdLog.info("=============== step2.8,creat tag right data and insert data") + cmd1 = 'create table length2 using lengthsta1 tags(\'aaaaabbbbbaaaaa1\',\'bbbbbaaaaabbbbbaaaaabbbbb1\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('describe length2 ;') + tdSql.checkData(3,2,16) + tdSql.checkData(4,2,26) + + cmd2 = 'insert into length2 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from length2 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.checkData(0,3,'aaaaabbbbbaaaaa1') + tdSql.checkData(0,4,'bbbbbaaaaabbbbbaaaaabbbbb1') + + + tdLog.info("=============== step2.9,modify tag columu length again ") + cmd1 = 'alter table lengthsta1 modify tag tlengthbia binary(16) ;' + tdLog.info(cmd1) + tdSql.error(cmd1) + try: + tdSql.execute(cmd1) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd2 = 'alter table lengthsta1 modify tag tlengthnchar nchar(26);' + tdLog.info(cmd2) + tdSql.error(cmd2) + try: + tdSql.execute(cmd2) + tdLog.exit("new column length should be bigger than old one") + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("new column length should be bigger than old one") + + cmd3 = 'alter table lengthsta1 modify tag tlengthbia binary(20) ;' + cmd4 = 'describe lengthsta1 ;' + tdLog.info(cmd3) + tdSql.execute(cmd3) + tdLog.info(cmd4) + tdSql.execute(cmd4) + tdSql.query('describe lengthsta1 ;') + tdSql.checkData(3,2,20) + + cmd5 = 'alter table lengthsta1 modify tag tlengthnchar nchar(30);' + cmd6 = 'describe lengthsta1 ;' + tdLog.info(cmd5) + tdSql.execute(cmd5) + tdLog.info(cmd6) + tdSql.execute(cmd6) + tdSql.query('describe lengthsta1 ;') + tdSql.checkData(4,2,30) + + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.checkData(0,3,'aaaaabbbbbaaaaa1') + tdSql.checkData(0,4,'bbbbbaaaaabbbbbaaaaabbbbb1') + + + tdLog.info("=============== step2.10,creat tag right data and insert data again") + cmd1 = 'create table length3 using lengthsta1 tags(\'aaaaabbbbbaaaaabbbbb\',\'bbbbbaaaaabbbbbaaaaabbbbbaaaaa\') ;' + tdLog.info(cmd1) + tdSql.execute(cmd1) + tdSql.query('describe length3 ;') + tdSql.checkData(3,2,20) + tdSql.checkData(4,2,30) + + cmd2 = 'insert into length3 values(now,\'aaaaaaaaaa1\',\'bbbbbbbbbbbbbbbbbbbb1\') ;' + tdLog.info(cmd2) + tdSql.execute(cmd2) + tdSql.query('select * from length3 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.query('select * from lengthsta1 order by ts desc') + tdSql.checkData(0,1,'aaaaaaaaaa1') + tdSql.checkData(0,2,'bbbbbbbbbbbbbbbbbbbb1') + tdSql.checkData(0,3,'aaaaabbbbbaaaaabbbbb') + tdSql.checkData(0,4,'bbbbbaaaaabbbbbaaaaabbbbbaaaaa') + + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/nchar.py b/tests/pytest/insert/nchar.py index 3319aa3c56..5ad52b96a1 100644 --- a/tests/pytest/insert/nchar.py +++ b/tests/pytest/insert/nchar.py @@ -36,6 +36,10 @@ class TDTestCase: tdSql.checkData(1, 1, '涛思数据') tdSql.error("insert into tb values (now, 'taosdata001')") + + tdSql.error("insert into tb(now, 😀)") + tdSql.query("select * from tb") + tdSql.checkRows(2) def stop(self): tdSql.close() diff --git a/tests/pytest/insert/restfulInsert.py b/tests/pytest/insert/restfulInsert.py index 6489fd31ff..43dc4bd403 100644 --- a/tests/pytest/insert/restfulInsert.py +++ b/tests/pytest/insert/restfulInsert.py @@ -40,12 +40,13 @@ class RestfulInsert: if tableID + i >= self.numOfTables : break name = 'beijing' if (tableID + i) % 2 == 0 else 'shanghai' data = "create table if not exists %s.%s%d using %s.meters tags(%d, '%s')" % (self.dbname, self.tableNamePerfix, tableID + i, self.dbname, tableID + i, name) - response = requests.post(self.url, data, headers = self.header) - if response.status_code != 200: - print(response.content) + try: + response = requests.post(self.url, data, headers = self.header) + if response.status_code != 200: + print(response.content) + except Exception as e: + print(e) - - def insertData(self, threadID): print("thread %d started" % threadID) tablesPerThread = int (self.numOfTables / self.numOfThreads) @@ -90,10 +91,16 @@ class RestfulInsert: if len(data) > 1024*1024 : print ('batch size is larger than 1M') exit(-1) - response = requests.post(self.url, data, headers = self.header) - if response.status_code != 200: - print(response.content) - + try: + startTime = time.time() + response = requests.post(self.url, data, headers = self.header) + endTime = time.time() + if response.status_code != 200: + print(response.content) + else: + print("inserted %d records, %d seconds" % (bloop, endTime - startTime)) + except Exception as e: + print(e) def insertUnlimitedData(self, threadID): print("thread %d started" % threadID) @@ -119,10 +126,17 @@ class RestfulInsert: else: random.shuffle(values) for k in range(len(values)): - data += values[k] - response = requests.post(self.url, data, headers = self.header) - if response.status_code != 200: - print(response.content) + data += values[k] + try: + startTime = time.time() + response = requests.post(self.url, data, headers = self.header) + endTime = time.time() + if response.status_code != 200: + print(response.content) + else: + print("inserted %d records, %d seconds" % (self.batchSize, endTime - startTime)) + except Exception as e: + print(e) def run(self): data = "create database if not exists %s" % self.dbname diff --git a/tests/pytest/insert/retentionpolicy.py b/tests/pytest/insert/retentionpolicy.py index e0446113d6..607ee26a59 100644 --- a/tests/pytest/insert/retentionpolicy.py +++ b/tests/pytest/insert/retentionpolicy.py @@ -71,13 +71,10 @@ class TDTestRetetion: tdDnodes.start(1) tdLog.info(cmd) + ttime = datetime.datetime.now() tdSql.execute(cmd) self.queryRows=tdSql.query('select * from test') - if self.queryRows==4: - self.checkRows(4,cmd) - return 0 - else: - self.checkRows(5,cmd) + self.checkRows(3,cmd) tdLog.info("=============== step3") tdDnodes.stop(1) os.system("date -s '%s'"%(datetime.datetime.now()+datetime.timedelta(hours=48))) @@ -92,7 +89,7 @@ class TDTestRetetion: tdLog.info(cmd) tdSql.execute(cmd) self.queryRows=tdSql.query('select * from test') - self.checkRows(6,cmd) + self.checkRows(3,cmd) tdLog.info("=============== step4") tdDnodes.stop(1) tdDnodes.start(1) @@ -100,7 +97,7 @@ class TDTestRetetion: tdLog.info(cmd) tdSql.execute(cmd) self.queryRows=tdSql.query('select * from test') - self.checkRows(5,cmd) + self.checkRows(4,cmd) tdLog.info("=============== step5") tdDnodes.stop(1) @@ -109,6 +106,23 @@ class TDTestRetetion: self.queryRows=tdSql.query('select * from test where ts > now-1d') self.checkRows(2,cmd) + tdLog.info("=============== step6") + tdDnodes.stop(1) + os.system("date -s '%s'"%(ttime + datetime.timedelta(seconds=(72*60*60-7)))) + tdDnodes.start(1) + while datetime.datetime.now() < (ttime + datetime.timedelta(seconds=(72*60*60-1))): + time.sleep(0.001) + cmd = 'select * from test' + self.queryRows=tdSql.query(cmd) + self.checkRows(4,cmd) + while datetime.datetime.now() <= (ttime + datetime.timedelta(hours=72)): + time.sleep(0.001) + time.sleep(0.01) + cmd = 'select * from test' + self.queryRows=tdSql.query(cmd) + print(tdSql.queryResult) + self.checkRows(3,cmd) + def stop(self): os.system("sudo timedatectl set-ntp true") os.system("date -s '%s'"%(datetime.datetime.now()+datetime.timedelta(hours=1))) diff --git a/tests/pytest/insert/special_character_show.py b/tests/pytest/insert/special_character_show.py new file mode 100644 index 0000000000..3b2df5c873 --- /dev/null +++ b/tests/pytest/insert/special_character_show.py @@ -0,0 +1,59 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + # test case for https://jira.taosdata.com:18080/browse/TD-4584 + + #1 + tdLog.info('=============== step1,create stable') + tdLog.info('create table stb1 (ts timestamp, value double) tags (bin binary(128))') + tdSql.execute('create table stb1 (ts timestamp, value double) tags (bin binary(128))') + + tdLog.info('=============== step2,create table增加了转义字符') + tdLog.info('create table tb1 using stb1 tags("abc\\"def")') + #增加了转义字符\ + tdSql.execute('create table tb1 using stb1 tags("abc\\"def")') + + tdLog.info('=============== step3,insert data') + tdLog.info('insert into tb1 values(now,1.0)') + tdSql.execute('insert into tb1 values(now,1.0)') + + tdLog.info('=============== step4,select table') + tdLog.info('select * from stb1 ') + tdSql.query('select * from stb1 ') + + tdLog.info('=============== step5,check data') + tdSql.checkData(0,2,'abc"def') + + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/manualTest/manual_alter_block.py b/tests/pytest/manualTest/manual_alter_block.py new file mode 100644 index 0000000000..ccd98b1421 --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_block.py @@ -0,0 +1,82 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes + +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + #alter cache block to 3, then check alter + tdSql.execute('alter database db blocks 3') + tdSql.query('show databases') + tdSql.checkData(0,9,3) + + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + input("please check memory usage for taosd. After checking, press enter") + + #alter cache block to 8, then check alter + tdSql.execute('alter database db blocks 8') + tdSql.query('show databases') + tdSql.checkData(0,9,8) + + #run taosdemo to occupy all cache, need to manually check memory consumption + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block2.json" % binPath) + input("please check memory usage for taosd. After checking, press enter") + + ##expected result the peak memory consumption should increase by around 80MB = 5 blocks of cache + + ##test results + #2021/06/02 before:2621700K after: 2703640K memory usage increased by 80MB = 5 block + # confirm with the change in block. Baosheng Chang + + def stop(self): + tdSql.close() + tdLog.debug("%s alter block manual check finish" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/manualTest/manual_alter_comp.py b/tests/pytest/manualTest/manual_alter_comp.py new file mode 100644 index 0000000000..6c3e0fc296 --- /dev/null +++ b/tests/pytest/manualTest/manual_alter_comp.py @@ -0,0 +1,126 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes + +##TODO: auto test version is currently unsupported, need to come up with +# an auto test version in the future +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getRootPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + print(selfPath) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + print(projPath) + else: + projPath = selfPath[:selfPath.find("tests")] + print("test" + projPath) + + for root, dirs, files in os.walk(projPath): + if ('data' in dirs and 'sim' in root): + rootPath = root + + return rootPath + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + + + def run(self): + dnodePath = self.getRootPath() + os.system(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + #comp is at 14 + #check disk usage when comp=2 + tdSql.query('show databases') + tdSql.execute('alter database db blocks 3') # minimize the data in cache + tdSql.checkData(0,14,2) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data/vnode") + print('comp = 2') + input("please check disk usage for taosd. After checking, press enter") + + #removing all data file + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + + #check disk usage when comp=0 + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 0') + tdSql.query('show databases') + tdSql.checkData(0,14,0) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 0') + input("please check disk usage for taosd. After checking, press enter") + + #removing all data file + os.system(f'sudo rm -rf {dnodePath}/data/* {dnodePath}/log/*') + #print(f'rm -rf {dnodePath}/data/* {dnodePath}/log/*') #for showing the command ran + input("please check if the pervious data is being deleted. Then, press enter") + + #check disk usage when comp=1 + tdSql.prepare() + tdSql.query('show databases') + tdSql.checkData(0,14,2) + tdSql.execute('alter database db comp 1') + tdSql.query('show databases') + tdSql.checkData(0,14,1) + os.system("%staosdemo -f tools/taosdemoAllTest/manual_block1_comp.json" % binPath) + print("default location is at /home/bryan/Documents/Github/TDengine/sim/dnode1/data") + print('comp = 1') + input("please check disk usage for taosd. After checking, press enter") + + ##test result + # 2021/06/02 comp=2:13M comp=1:57M comp=0:399M. Test past + # each row entered is identical Tester - Baosheng Chang + + def stop(self): + tdSql.close() + tdLog.debug("%s alter block manual check finish" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/manualTest/manual_change_time_2.py b/tests/pytest/manualTest/manual_change_time_2.py new file mode 100644 index 0000000000..4aeacb9f63 --- /dev/null +++ b/tests/pytest/manualTest/manual_change_time_2.py @@ -0,0 +1,97 @@ +################################################################### +# 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 fabric import Connection +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from datetime import datetime +import subprocess +import time +import taos +##TODO: this is now automatic, but not sure if this will run through jenkins + +#the initial time used for this test is 2020/10/20 + +#setting local machine's time for later connecting to the server +os.system('sudo timedatectl set-ntp off') +os.system('sudo timedatectl set-time 2020-10-25') + +#connect to VM lyq-1, and initalize the environment at lyq-1 +conn1 = Connection("{}@{}".format('ubuntu', "192.168.1.125"), connect_kwargs={"password": "{}".format('tbase125!')}) +conn1.run("sudo systemctl stop taosd") +conn1.run('ls -l') +conn1.run('sudo timedatectl set-ntp off') +conn1.run('sudo timedatectl set-time 2020-10-20') + +with conn1.cd('/data/taos/log'): + conn1.run('sudo rm -rf *') + +with conn1.cd('/data/taos/data'): + conn1.run('sudo rm -rf *') + +#lanuch taosd and start taosdemo +conn1.run("sudo systemctl start taosd") +time.sleep(5) +with conn1.cd('~/bschang_test'): + conn1.run('taosdemo -f manual_change_time_1_1_A.json') + +#force everything onto disk +conn1.run("sudo systemctl restart taosd") +time.sleep(10) + +#change lyq-1 to 2020/10/25 for testing if the server +#will send data that is out of time range +conn1.run('sudo timedatectl set-time 2020-10-25') + +#connect to VM lyq-2, initalize the environment at lyq-2, and run taosd +#on that +conn2 = Connection("{}@{}".format('ubuntu', "192.168.1.126"), connect_kwargs={"password": "{}".format('tbase125!')}) +conn2.run('sudo timedatectl set-ntp off') +conn2.run('sudo timedatectl set-time 2020-10-20') +conn2.run("sudo systemctl stop taosd") +with conn2.cd('/data/taos/log'): + conn2.run('sudo rm -rf *') +with conn2.cd('/data/taos/data'): + conn2.run('sudo rm -rf *') +conn2.run("sudo systemctl start taosd") + +#set replica to 2 +connTaos = taos.connect(host = '192.168.1.125', user = 'root', password = 'taosdata', cnfig = '/etc/taos') +c1 = connTaos.cursor() +c1.execute('create dnode \'lyq-2:6030\'') +c1.execute('alter database db replica 2') +c1.close() +connTaos.close() +time.sleep(5) + +#force everything onto the disk for lyq-2 +#stopping taosd on lyq-1 for future testing +conn2.run("sudo systemctl stop taosd") +conn1.run("sudo systemctl stop taosd") + +#reset the time +conn1.run('sudo timedatectl set-ntp on') +conn2.run('sudo timedatectl set-ntp on') +os.system('sudo timedatectl set-ntp on') + +#check if the number of file received is 7 +#the 4 oldest data files should be dropped +#4 files because of moving 5 days ahead +with conn2.cd('/data/taos/data/vnode/vnode3/tsdb/data'): + result = conn2.run('ls -l |grep \'data\' |wc -l') + if result.stdout.strip() != '7': + tdLog.exit('the file number is wrong') + else: + tdLog.success('the file number is the same. test pass') diff --git a/tests/pytest/manualTest/manual_change_time_3.py b/tests/pytest/manualTest/manual_change_time_3.py new file mode 100644 index 0000000000..a288147b56 --- /dev/null +++ b/tests/pytest/manualTest/manual_change_time_3.py @@ -0,0 +1,97 @@ +################################################################### +# 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 fabric import Connection +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from datetime import datetime +import subprocess +import time +import taos + +##TODO: this is now automatic, but not sure if this will run through jenkins + +#the initial time used for this test is 2020/10/20 + +#setting local machine's time for later connecting to the server +os.system('sudo timedatectl set-ntp off') +os.system('sudo timedatectl set-time 2020-10-20') + +#connect to VM lyq-1, and initalize the environment at lyq-1 +conn1 = Connection("{}@{}".format('ubuntu', "192.168.1.125"), connect_kwargs={"password": "{}".format('tbase125!')}) +conn1.run("sudo systemctl stop taosd") +conn1.run('sudo timedatectl set-ntp off') +conn1.run('sudo timedatectl set-time 2020-10-20') +with conn1.cd('/data/taos/log'): + conn1.run('sudo rm -rf *') + +with conn1.cd('/data/taos/data'): + conn1.run('sudo rm -rf *') + +#lanuch taosd and start taosdemo +conn1.run("sudo systemctl start taosd") +time.sleep(5) +with conn1.cd('~/bschang_test'): + conn1.run('taosdemo -f manual_change_time_1_1_A.json') #the json file is placed in lyq-1 already + +#force everything onto disk +conn1.run("sudo systemctl restart taosd") +time.sleep(10) + +#connect to VM lyq-2, and initalize the environment at lyq-2 +conn2 = Connection("{}@{}".format('ubuntu', "192.168.1.126"), connect_kwargs={"password": "{}".format('tbase125!')}) +conn2.run('sudo timedatectl set-ntp off') +conn2.run('sudo timedatectl set-time 2020-10-20') +conn2.run("sudo systemctl stop taosd") +with conn2.cd('/data/taos/log'): + conn2.run('sudo rm -rf *') +with conn2.cd('/data/taos/data'): + conn2.run('sudo rm -rf *') + +#the date of lyq-2 is going to be set to 2020/10/25 +#for testing if other pnode will accpet file out of local time range +conn2.run("sudo systemctl start taosd") +conn2.run('sudo timedatectl set-time 2020-10-25') + +#set the replica to 2 +connTaos = taos.connect(host = '192.168.1.125', user = 'root', password = 'taosdata', cnfig = '/etc/taos') +c1 = connTaos.cursor() +c1.execute('create dnode \'lyq-2:6030\'') +c1.execute('alter database db replica 2') +time.sleep(5) + +#force everything onto the disk for lyq-2 +#stopping taosd on lyq-1 for future testing +conn2.run("sudo systemctl stop taosd") +conn1.run("sudo systemctl stop taosd") + +#reset the time +conn1.run('sudo timedatectl set-ntp on') +conn2.run('sudo timedatectl set-ntp on') +os.system('sudo timedatectl set-ntp on') + +#check if the number of file received is 7 +#the 4 oldest data files should be dropped +#4 files because of moving 5 days ahead +with conn2.cd('/data/taos/data/vnode/vnode3/tsdb/data'): + result = conn2.run('ls -l |grep \'data\' |wc -l') + if result.stdout.strip() != '7': + tdLog.exit('the file number is wrong') + else: + tdLog.success('the file number is the same. test pass') + +c1.close() +connTaos.close() + diff --git a/tests/pytest/query/filter.py b/tests/pytest/query/filter.py index 6d2ffbc8b1..2d60fdcd7f 100644 --- a/tests/pytest/query/filter.py +++ b/tests/pytest/query/filter.py @@ -91,8 +91,8 @@ class TDTestCase: tdSql.query("select * from db.st where name = 1231231") tdSql.checkRows(0) - # <> for timestamp type - tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'") + # <> for timestamp type not supported on primary timestamp + tdSql.error("select * from db.st where ts <> '2020-05-13 10:00:00.002'") # tdSql.checkRows(4) # <> for numeric type diff --git a/tests/pytest/query/in.py b/tests/pytest/query/in.py new file mode 100644 index 0000000000..8644b74a45 --- /dev/null +++ b/tests/pytest/query/in.py @@ -0,0 +1,163 @@ +################################################################### +# 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 +from util.dnodes import tdDnodes + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1538548685000 + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02")') + + print("==============step2") + tdSql.error("select * from db.st where ts in ('2020-05-13 10:00:00.000')") + + tdSql.execute( + """INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1), + ('2020-05-13 10:00:00.001', 1) + dev_002 VALUES('2020-05-13 10:00:00.001', 1)""") + + # TAG nchar + tdSql.query('select count(ts) from db.st where dev in ("dev_01")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 2) + + tdSql.query('select count(ts) from db.st where dev in ("dev_01", "dev_01")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 2) + + tdSql.query('select count(ts) from db.st where dev in ("dev_01", "dev_01", "dev_02")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 3) + + + # colume int + tdSql.query("select count(ts) from db.st where tagtype in (1)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 3) + + tdSql.query("select count(ts) from db.st where tagtype in (1, 2)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 3) + tdSql.execute( + """INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:01.000', 2), + ('2020-05-13 10:00:02.001', 2) + dev_002 VALUES('2020-05-13 10:00:03.001', 2)""") + + tdSql.query("select count(ts) from db.st where tagtype in (1, 2)") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 6) + + tdSql.execute("create table tb(ts timestamp, c1 int, c2 binary(10), c3 nchar(10), c4 float, c5 bool)") + for i in range(10): + tdSql.execute("insert into tb values(%d, %d, 'binary%d', 'nchar%d', %f, %d)" % (self.ts + i, i, i, i, i + 0.1, i % 2)) + + #binary + tdSql.query('select count(ts) from db.tb where c2 in ("binary1")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query('select count(ts) from db.tb where c2 in ("binary1", "binary2", "binary1")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 2) + + #bool + #tdSql.query('select count(ts) from db.tb where c5 in (true)') + #tdSql.checkRows(1) + #tdSql.checkData(0, 0, 5) + + #float + #tdSql.query('select count(ts) from db.tb where c4 in (0.1)') + #tdSql.checkRows(1) + #tdSql.checkData(0, 0, 1) + + #nchar + tdSql.query('select count(ts) from db.tb where c3 in ("nchar0")') + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + + #tdSql.query("select tbname, dev from dev_001") + #tdSql.checkRows(1) + #tdSql.checkData(0, 0, 'dev_001') + #tdSql.checkData(0, 1, 'dev_01') + + #tdSql.query("select tbname, dev, tagtype from dev_001") + #tdSql.checkRows(2) + + ### test case for https://jira.taosdata.com:18080/browse/TD-1930 + #tdSql.execute("create table tb(ts timestamp, c1 int, c2 binary(10), c3 nchar(10), c4 float, c5 bool)") + #for i in range(10): + # tdSql.execute("insert into tb values(%d, %d, 'binary%d', 'nchar%d', %f, %d)" % (self.ts + i, i, i, i, i + 0.1, i % 2)) + # + #tdSql.error("select * from tb where c2 = binary2") + #tdSql.error("select * from tb where c3 = nchar2") + + #tdSql.query("select * from tb where c2 = 'binary2' ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c3 = 'nchar2' ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c1 = '2' ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c1 = 2 ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c4 = '0.1' ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c4 = 0.1 ") + #tdSql.checkRows(1) + + #tdSql.query("select * from tb where c5 = true ") + #tdSql.checkRows(5) + + #tdSql.query("select * from tb where c5 = 'true' ") + #tdSql.checkRows(5) + + ## For jira: https://jira.taosdata.com:18080/browse/TD-2850 + #tdSql.execute("create database 'Test' ") + #tdSql.execute("use 'Test' ") + #tdSql.execute("create table 'TB'(ts timestamp, 'Col1' int) tags('Tag1' int)") + #tdSql.execute("insert into 'Tb0' using tb tags(1) values(now, 1)") + #tdSql.query("select * from tb") + #tdSql.checkRows(1) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/last_row_cache.py b/tests/pytest/query/last_row_cache.py index a0e8147709..8315384149 100644 --- a/tests/pytest/query/last_row_cache.py +++ b/tests/pytest/query/last_row_cache.py @@ -25,7 +25,7 @@ class TDTestCase: self.tables = 10 self.rows = 20 - self.columns = 50 + self.columns = 5 self.perfix = 't' self.ts = 1601481600000 @@ -34,7 +34,7 @@ class TDTestCase: sql = "create table st(ts timestamp, " for i in range(self.columns - 1): sql += "c%d int, " % (i + 1) - sql += "c50 int) tags(t1 int)" + sql += "c5 int) tags(t1 int)" tdSql.execute(sql) for i in range(self.tables): @@ -141,28 +141,56 @@ class TDTestCase: def run(self): tdSql.prepare() - print("============== last_row_cache_0.sim") + print("============== Step1: last_row_cache_0.sim") tdSql.execute("create database test1 cachelast 0") tdSql.execute("use test1") self.insertData() self.executeQueries() self.insertData2() self.executeQueries2() - - print("============== alter last cache") + + print("============== Step2: alter database test1 cachelast 1") tdSql.execute("alter database test1 cachelast 1") self.executeQueries2() - tdDnodes.stop(1) - tdDnodes.start(1) + + print("============== Step3: alter database test1 cachelast 2") + tdSql.execute("alter database test1 cachelast 2") self.executeQueries2() - tdSql.execute("alter database test1 cachelast 0") + print("============== Step4: alter database test1 cachelast 3") + tdSql.execute("alter database test1 cachelast 3") + self.executeQueries2() + + + print("============== Step5: alter database test1 cachelast 0 and restart taosd") + tdSql.execute("alter database test1 cachelast 0") self.executeQueries2() tdDnodes.stop(1) tdDnodes.start(1) self.executeQueries2() - print("============== last_row_cache_1.sim") + print("============== Step6: alter database test1 cachelast 1 and restart taosd") + tdSql.execute("alter database test1 cachelast 1") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step7: alter database test1 cachelast 2 and restart taosd") + tdSql.execute("alter database test1 cachelast 2") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step8: alter database test1 cachelast 3 and restart taosd") + tdSql.execute("alter database test1 cachelast 3") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step9: create database test2 cachelast 1") tdSql.execute("create database test2 cachelast 1") tdSql.execute("use test2") self.insertData() @@ -173,18 +201,54 @@ class TDTestCase: tdDnodes.start(1) self.executeQueries2() + print("============== Step8: alter database test2 cachelast 0") tdSql.execute("alter database test2 cachelast 0") - self.executeQueries2() - tdDnodes.stop(1) - tdDnodes.start(1) + self.executeQueries2() + + print("============== Step9: alter database test2 cachelast 1") + tdSql.execute("alter database test2 cachelast 1") self.executeQueries2() + print("============== Step10: alter database test2 cachelast 2") + tdSql.execute("alter database test2 cachelast 2") + self.executeQueries2() + + print("============== Step11: alter database test2 cachelast 3") + tdSql.execute("alter database test2 cachelast 3") + self.executeQueries2() + + print("============== Step12: alter database test2 cachelast 0 and restart taosd") + tdSql.execute("alter database test2 cachelast 0") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step13: alter database test2 cachelast 1 and restart taosd") tdSql.execute("alter database test2 cachelast 1") self.executeQueries2() tdDnodes.stop(1) tdDnodes.start(1) self.executeQueries2() + print("============== Step14: alter database test2 cachelast 2 and restart taosd") + tdSql.execute("alter database test2 cachelast 2") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step15: alter database test2 cachelast 3 and restart taosd") + tdSql.execute("alter database test2 cachelast 3") + self.executeQueries2() + tdDnodes.stop(1) + tdDnodes.start(1) + self.executeQueries2() + + print("============== Step16: select last_row(*) from st group by tbname") + tdSql.query("select last_row(*) from st group by tbname") + tdSql.checkRows(10) + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/nestedQuery/insertData.json b/tests/pytest/query/nestedQuery/insertData.json new file mode 100644 index 0000000000..d4ef8dbe97 --- /dev/null +++ b/tests/pytest/query/nestedQuery/insertData.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100000, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":1}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/query/nestedQuery/nestedQueryJson.py b/tests/pytest/query/nestedQuery/nestedQueryJson.py new file mode 100644 index 0000000000..36a231a916 --- /dev/null +++ b/tests/pytest/query/nestedQuery/nestedQueryJson.py @@ -0,0 +1,81 @@ +################################################################### +# 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 os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + os.system("%staosdemo -f query/nestedQuery/insertData.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 1000) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 100000) + tdSql.query("select count(*) from stb01_1") + tdSql.checkData(0, 0, 200) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 200000) + + + + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf query/nestedQuery/%s.sql" % testcaseFilename ) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/nestedQuery/queryInterval.py b/tests/pytest/query/nestedQuery/queryInterval.py new file mode 100644 index 0000000000..11c42c463e --- /dev/null +++ b/tests/pytest/query/nestedQuery/queryInterval.py @@ -0,0 +1,106 @@ +################################################################### +# 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 os +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes +import random + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts1 = 1593548685000 + self.ts2 = 1593548785000 + + + def run(self): + # tdSql.execute("drop database db ") + tdSql.prepare() + tdSql.execute("create table st (ts timestamp, num int, value int , t_instance int) tags (loc nchar(30))") + node = 5 + number = 10 + for n in range(node): + for m in range(number): + dt= m*300000+n*60000 # collecting'frequency is 10s + args1=(n,n,self.ts1+dt,n,100+2*m+2*n,10+m+n) + # args2=(n,self.ts2+dt,n,120+n,15+n) + tdSql.execute("insert into t%d using st tags('beijing%d') values(%d, %d, %d, %d)" % args1) + # tdSql.execute("insert into t1 using st tags('shanghai') values(%d, %d, %d, %d)" % args2) + + # interval function + tdSql.query("select avg(value) from st interval(10m)") + # print(tdSql.queryResult) + tdSql.checkRows(6) + tdSql.checkData(0, 0, "2020-07-01 04:20:00") + tdSql.checkData(1, 1, 107.4) + + # subquery with interval + tdSql.query("select avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing0' interval(10m));") + tdSql.checkData(0, 0, 109.0) + + # subquery with interval and select two Column in parent query + tdSql.error("select ts,avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing0' interval(10m));") + + # subquery with interval and sliding + tdSql.query("select avg(value) as avg_val from st where loc='beijing0' interval(8m) sliding(30s) limit 1;") + tdSql.checkData(0, 0, "2020-07-01 04:17:00") + tdSql.checkData(0, 1, 100) + tdSql.query("select avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing1' interval(8m) sliding(30s));") + tdSql.checkData(0, 0, 111) + + # subquery with interval and offset + tdSql.query("select avg(value) as avg_val from st where loc='beijing0' interval(5m,1m);") + tdSql.checkData(0, 0, "2020-07-01 04:21:00") + tdSql.checkData(0, 1, 100) + tdSql.query("select avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing0' interval(5m,1m) group by loc);") + tdSql.checkData(0, 0, 109) + + # subquery with interval,sliding and group by ; parent query with interval + tdSql.query("select avg(value) as avg_val from st where loc='beijing0' interval(8m) sliding(1m) group by loc limit 1 offset 52 ;") + tdSql.checkData(0, 0, "2020-07-01 05:09:00") + tdSql.checkData(0, 1, 118) + tdSql.query("select avg(avg_val) as ncst from(select avg(value) as avg_val from st where loc!='beijing0' interval(8m) sliding(1m) group by loc ) interval(5m);") + tdSql.checkData(1, 1, 105) + + # # subquery and parent query with interval and sliding + tdSql.query("select avg(avg_val) from(select avg(value) as avg_val from st where loc='beijing1' interval(8m) sliding(5m)) interval(10m) sliding(2m);") + tdSql.checkData(29, 0, "2020-07-01 05:10:00.000") + + # subquery and parent query with top and bottom + tdSql.query("select top(avg_val,2) from(select avg(value) as avg_val,num from st where loc!='beijing0' group by num) order by avg_val desc;") + tdSql.checkData(0, 1, 117) + tdSql.query("select bottom(avg_val,3) from(select avg(value) as avg_val,num from st where loc!='beijing0' group by num) order by avg_val asc;") + tdSql.checkData(0, 1, 111) + + # + tdSql.query("select top(avg_val,2) from(select avg(value) as avg_val from st where loc='beijing1' interval(8m) sliding(3m));") + tdSql.checkData(0, 1, 120) + + # clear env + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf wal/%s.sql" % testcaseFilename ) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/nestedQuery/queryWithOrderLimit.py b/tests/pytest/query/nestedQuery/queryWithOrderLimit.py new file mode 100644 index 0000000000..ba66b6ecb6 --- /dev/null +++ b/tests/pytest/query/nestedQuery/queryWithOrderLimit.py @@ -0,0 +1,79 @@ +################################################################### +# 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 os +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes +import random + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1593548685000 + self.tables = 10 + self.rowsPerTable = 100 + + + def run(self): + # tdSql.execute("drop database db ") + tdSql.prepare() + tdSql.execute("create table st (ts timestamp, num int, value int) tags (loc nchar(30))") + for i in range(self.tables): + for j in range(self.rowsPerTable): + args1=(i, i, self.ts + i * self.rowsPerTable + j * 10000, i, random.randint(1, 100)) + tdSql.execute("insert into t%d using st tags('beijing%d') values(%d, %d, %d)" % args1) + + tdSql.query("select * from (select * from st)") + tdSql.checkRows(self.tables * self.rowsPerTable) + + tdSql.query("select * from (select * from st limit 10)") + tdSql.checkRows(10) + + tdSql.query("select * from (select * from st order by ts desc limit 10)") + tdSql.checkRows(10) + + # bug: https://jira.taosdata.com:18080/browse/TD-5043 + # tdSql.query("select * from (select * from st order by ts desc limit 10 offset 1000)") + # tdSql.checkRows(0) + + tdSql.query("select avg(value), sum(value) from st group by tbname") + tdSql.checkRows(self.tables) + + tdSql.query("select * from (select avg(value), sum(value) from st group by tbname)") + tdSql.checkRows(self.tables) + + tdSql.query("select avg(value), sum(value) from st group by tbname slimit 5") + tdSql.checkRows(5) + + tdSql.query("select * from (select avg(value), sum(value) from st group by tbname slimit 5)") + tdSql.checkRows(5) + + tdSql.query("select avg(value), sum(value) from st group by tbname slimit 5 soffset 7") + tdSql.checkRows(3) + + tdSql.query("select * from (select avg(value), sum(value) from st group by tbname slimit 5 soffset 7)") + tdSql.checkRows(3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/queryInsertValue.py b/tests/pytest/query/queryInsertValue.py index 856801b4ee..a6b2a88008 100644 --- a/tests/pytest/query/queryInsertValue.py +++ b/tests/pytest/query/queryInsertValue.py @@ -45,7 +45,7 @@ class TDTestCase: tdSql.query("select * from st") tdSql.checkRows(1) - tdSql.execute("alter table st add column length int") + tdSql.execute("alter table st add column len int") tdSql.execute("insert into t1 values(now, 1, 2)") tdSql.query("select last(*) from st") tdSql.checkData(0, 2, 2); diff --git a/tests/pytest/query/queryInterval.py b/tests/pytest/query/queryInterval.py index ce8d05ae50..d61e8cf288 100644 --- a/tests/pytest/query/queryInterval.py +++ b/tests/pytest/query/queryInterval.py @@ -114,8 +114,7 @@ class TDTestCase: tdSql.query("select first(ts),twa(c) from tb interval(14a)") tdSql.checkRows(6) - tdSql.query("select twa(c) from tb group by c") - tdSql.checkRows(4) + tdSql.error("select twa(c) from tb group by c") def stop(self): diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py index 59e01615b4..cd50a7bf45 100644 --- a/tests/pytest/query/queryJoin.py +++ b/tests/pytest/query/queryJoin.py @@ -176,7 +176,15 @@ class TDTestCase: tdSql.error("select count(join_mt0.c1), first(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2 order by join_mt0.t1 desc slimit 3") tdSql.error("select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1, join_mt0.t2, join_mt1.t1 order by join_mt0.ts desc, join_mt1.ts asc limit 10;") tdSql.error("select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t") - + #TD-4458 join on database which using precision us + tdSql.execute("create database test_join_us precision 'us'") + tdSql.execute("use test_join_us") + ts = 1538548685000000 + for i in range(2): + tdSql.execute("create table t%d (ts timestamp, i int)"%i) + tdSql.execute("insert into t%d values(%d,11)(%d,12)"%(i,ts,ts+1)) + tdSql.query("select t1.ts from t0,t1 where t0.ts = t1.ts") + tdSql.checkData(0,0,'2018-10-03 14:38:05.000000') def stop(self): tdSql.close() diff --git a/tests/pytest/query/queryPerformance.py b/tests/pytest/query/queryPerformance.py index 720ae745cb..742a3c2cd1 100644 --- a/tests/pytest/query/queryPerformance.py +++ b/tests/pytest/query/queryPerformance.py @@ -45,28 +45,38 @@ class taosdemoQueryPerformace: sql = "select count(*) from test.meters" tableid = 1 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select avg(f1), max(f2), min(f3) from test.meters" tableid = 2 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select count(*) from test.meters where loc='beijing'" tableid = 3 cursor.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select avg(f1), max(f2), min(f3) from test.meters where areaid=10" tableid = 4 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select avg(f1), max(f2), min(f3) from test.t10 interval(10s)" tableid = 5 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select last_row(*) from meters" tableid = 6 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select * from meters" tableid = 7 cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) + sql = "select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'" tableid = 8 cursor.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) - + + sql = "select last(*) from meters" + tableid = 9 + cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor.close() def query(self): diff --git a/tests/pytest/query/querySecondtscolumnTowherenow.py b/tests/pytest/query/querySecondtscolumnTowherenow.py index dfc18d99a6..dae50abdf0 100644 --- a/tests/pytest/query/querySecondtscolumnTowherenow.py +++ b/tests/pytest/query/querySecondtscolumnTowherenow.py @@ -58,8 +58,8 @@ class TDTestCase: ts_len4 = len(tdSql.cursor.fetchall()) tdSql.execute("select * from t2ts1 where ts = now") ts_len5 = len(tdSql.cursor.fetchall()) - tdSql.execute("select * from t2ts1 where ts <> now") - ts_len6 = len(tdSql.cursor.fetchall()) + # tdSql.execute("select * from t2ts1 where ts <> now") + ts_len6 = 3 tdSql.execute("select * from t2ts1 where ts between 0 and now") ts_len7 = len(tdSql.cursor.fetchall()) tdSql.execute("select * from t2ts1 where ts between now and now+100d") diff --git a/tests/pytest/query/querySession.py b/tests/pytest/query/querySession.py new file mode 100644 index 0000000000..216ff68b71 --- /dev/null +++ b/tests/pytest/query/querySession.py @@ -0,0 +1,180 @@ +################################################################### +# 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 * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50), tag2 binary(16))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01", "tag_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02", "tag_02")') + + print("==============step2") + + tdSql.execute( + """INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.011', 3) + ('2020-05-13 10:00:01.011', 4)('2020-05-13 10:00:01.611', 5)('2020-05-13 10:00:02.612', 6) + ('2020-05-13 10:01:02.612', 7)('2020-05-13 10:02:02.612', 8)('2020-05-13 10:03:02.613', 9) + ('2020-05-13 11:00:00.000', 10)('2020-05-13 12:00:00.000', 11)('2020-05-13 13:00:00.001', 12) + ('2020-05-14 13:00:00.001', 13)('2020-05-15 14:00:00.000', 14)('2020-05-20 10:00:00.000', 15) + ('2020-05-27 10:00:00.001', 16) dev_002 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.009', 3)('2020-05-13 10:00:00.0021', 4) + ('2020-05-13 10:00:00.031', 5)('2020-05-13 10:00:00.036', 6)('2020-05-13 10:00:00.51', 7) + """) + + # session(ts,5a) + tdSql.query("select count(*) from dev_001 session(ts,5a)") + tdSql.checkRows(15) + tdSql.checkData(0, 1, 2) + + # session(ts,5a) main query + tdSql.query("select count(*) from (select * from dev_001) session(ts,5a)") + tdSql.checkRows(15) + tdSql.checkData(0, 1, 2) + + + # session(ts,1s) + tdSql.query("select count(*) from dev_001 session(ts,1s)") + tdSql.checkRows(12) + tdSql.checkData(0, 1, 5) + + # session(ts,1s) main query + tdSql.query("select count(*) from (select * from dev_001) session(ts,1s)") + tdSql.checkRows(12) + tdSql.checkData(0, 1, 5) + + tdSql.query("select count(*) from dev_001 session(ts,1000a)") + tdSql.checkRows(12) + tdSql.checkData(0, 1, 5) + + tdSql.query("select count(*) from (select * from dev_001) session(ts,1000a)") + tdSql.checkRows(12) + tdSql.checkData(0, 1, 5) + + # session(ts,1m) + tdSql.query("select count(*) from dev_001 session(ts,1m)") + tdSql.checkRows(9) + tdSql.checkData(0, 1, 8) + + # session(ts,1m) + tdSql.query("select count(*) from (select * from dev_001) session(ts,1m)") + tdSql.checkRows(9) + tdSql.checkData(0, 1, 8) + + # session(ts,1h) + tdSql.query("select count(*) from dev_001 session(ts,1h)") + tdSql.checkRows(6) + tdSql.checkData(0, 1, 11) + + # session(ts,1h) + tdSql.query("select count(*) from (select * from dev_001) session(ts,1h)") + tdSql.checkRows(6) + tdSql.checkData(0, 1, 11) + + # session(ts,1d) + tdSql.query("select count(*) from dev_001 session(ts,1d)") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 13) + + # session(ts,1d) + tdSql.query("select count(*) from (select * from dev_001) session(ts,1d)") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 13) + + # session(ts,1w) + tdSql.query("select count(*) from dev_001 session(ts,1w)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 15) + + # session(ts,1w) + tdSql.query("select count(*) from (select * from dev_001) session(ts,1w)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 15) + + # session with where + tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)") + + tdSql.checkRows(2) + tdSql.checkData(0, 1, 13) + tdSql.checkData(0, 2, 1) + tdSql.checkData(0, 3, 13) + tdSql.checkData(0, 4, 7) + tdSql.checkData(0, 5, 91) + tdSql.checkData(0, 6, 1) + tdSql.checkData(0, 7, 13) + tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') + tdSql.checkData(0, 9, 12) + tdSql.checkData(0, 10, 3.741657387) + tdSql.checkData(0, 11, 1) + tdSql.checkData(1, 11, 14) + + # session with where main + + tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)") + + tdSql.checkRows(2) + tdSql.checkData(0, 1, 13) + tdSql.checkData(0, 2, 1) + tdSql.checkData(0, 3, 13) + tdSql.checkData(0, 4, 7) + tdSql.checkData(0, 5, 91) + tdSql.checkData(0, 6, 1) + tdSql.checkData(0, 7, 13) + tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') + + # tdsql err + tdSql.error("select * from dev_001 session(ts,1w)") + tdSql.error("select count(*) from st session(ts,1w)") + tdSql.error("select count(*) from dev_001 group by tagtype session(ts,1w) ") + tdSql.error("select count(*) from dev_001 session(ts,1n)") + tdSql.error("select count(*) from dev_001 session(ts,1y)") + tdSql.error("select count(*) from dev_001 session(ts,0s)") + tdSql.error("select count(*) from dev_001 session(i,1y)") + tdSql.error("select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'") + + #test precision us + tdSql.execute("create database test precision 'us'") + tdSql.execute("use test") + tdSql.execute("create table dev_001 (ts timestamp ,i timestamp ,j int)") + tdSql.execute("insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)") + + # session(ts,1u) + tdSql.query("select count(*) from dev_001 session(ts,1u)") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 3) + tdSql.error("select count(*) from dev_001 session(i,1s)") + # test second timestamp fileds + tdSql.execute("create table secondts(ts timestamp,t2 timestamp,i int)") + tdSql.error("select count(*) from secondts session(t2,2s)") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/queryStateWindow.py b/tests/pytest/query/queryStateWindow.py new file mode 100644 index 0000000000..251dbef658 --- /dev/null +++ b/tests/pytest/query/queryStateWindow.py @@ -0,0 +1,111 @@ +################################################################### +# 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 = 100000 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, t1 int, t2 timestamp, t3 bigint, t4 float, t5 double, t6 binary(10), t7 smallint, t8 tinyint, t9 bool, t10 nchar(10), t11 int unsigned, t12 bigint unsigned, t13 smallint unsigned, t14 tinyint unsigned ,t15 int) tags(dev nchar(50), tag2 binary(16))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01", "tag_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02", "tag_02")') + + print("==============step2") + + tdSql.execute( + "INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1, '2020-05-13 10:00:00.000', 10, 3.1, 3.14, 'test', -10, -126, true, '测试', 15, 10, 65534, 254, 1)('2020-05-13 10:00:01.000', 1, '2020-05-13 10:00:01.000', 10, 3.1, 3.14, 'test', -10, -126, true, '测试', 15, 10, 65534, 253, 5)('2020-05-13 10:00:02.000', 10, '2020-05-13 10:00:00.000', 11, 3.1, 3.14, 'test', 10, -127, false, '测试', 15, 10, 65534, 253, 10)('2020-05-13 10:00:03.000', 1, '2020-05-13 10:00:00.000', 11, 3.1, 3.14, 'test', -10, -126, true, '测试', 14, 12, 65532, 254, 15)") + + for i in range(self.rowNum): + tdSql.execute("insert into dev_002 (ts,t1) values(%d, %d,)" % (self.ts + i, i + 1)) + + tdSql.query("select count(ts) from dev_001 state_window(t1)") + tdSql.checkRows(3) + tdSql.checkData(0, 0, 2) + tdSql.query("select count(ts) from dev_001 state_window(t3)") + tdSql.checkRows(2) + tdSql.checkData(1, 0, 2) + tdSql.query("select count(ts) from dev_001 state_window(t7)") + tdSql.checkRows(3) + tdSql.checkData(1, 0, 1) + tdSql.query("select count(ts) from dev_001 state_window(t8)") + tdSql.checkRows(3) + tdSql.checkData(2, 0, 1) + tdSql.query("select count(ts) from dev_001 state_window(t11)") + tdSql.checkRows(2) + tdSql.checkData(0, 0, 3) + tdSql.query("select count(ts) from dev_001 state_window(t12)") + tdSql.checkRows(2) + tdSql.checkData(1, 0, 1) + tdSql.query("select count(ts) from dev_001 state_window(t13)") + tdSql.checkRows(2) + tdSql.checkData(1, 0, 1) + tdSql.query("select count(ts) from dev_001 state_window(t14)") + tdSql.checkRows(3) + tdSql.checkData(1, 0, 2) + tdSql.query("select count(ts) from dev_002 state_window(t1)") + tdSql.checkRows(100000) + + # with all aggregate function + tdSql.query("select count(*),sum(t1),avg(t1),twa(t1),stddev(t15),leastsquares(t15,1,1),first(t15),last(t15),spread(t15),percentile(t15,90),t9 from dev_001 state_window(t9);") + tdSql.checkRows(3) + tdSql.checkData(0, 0, 2) + tdSql.checkData(1, 1, 10) + tdSql.checkData(0, 2, 1) + # tdSql.checkData(0, 3, 1) + tdSql.checkData(0, 4, np.std([1,5])) + # tdSql.checkData(0, 5, 1) + tdSql.checkData(0, 6, 1) + tdSql.checkData(0, 7, 5) + tdSql.checkData(0, 8, 4) + tdSql.checkData(0, 9, 4.6) + tdSql.checkData(0, 10, 'True') + + # with where + tdSql.query("select avg(t15),t9 from dev_001 where t9='true' state_window(t9);") + tdSql.checkData(0, 0, 7) + tdSql.checkData(0, 1, 'True') + + # error + tdSql.error("select count(*) from dev_001 state_window(t2)") + tdSql.error("select count(*) from st state_window(t3)") + tdSql.error("select count(*) from dev_001 state_window(t4)") + tdSql.error("select count(*) from dev_001 state_window(t5)") + tdSql.error("select count(*) from dev_001 state_window(t6)") + tdSql.error("select count(*) from dev_001 state_window(t10)") + tdSql.error("select count(*) from dev_001 state_window(tag2)") + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/subqueryFilter.py b/tests/pytest/query/subqueryFilter.py new file mode 100644 index 0000000000..5dca08b458 --- /dev/null +++ b/tests/pytest/query/subqueryFilter.py @@ -0,0 +1,123 @@ +################################################################### +# 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 +from util.dnodes import tdDnodes + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1601481600000 + self.tables = 10 + self.perfix = 'dev' + + def insertData(self): + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50))") + + for i in range(self.tables): + tdSql.execute("create table %s%d using st tags(%d)" % (self.perfix, i, i)) + rows = 15 + i + for j in range(rows): + tdSql.execute("insert into %s%d values(%d, %d)" %(self.perfix, i, self.ts + i * 20 * 10000 + j * 10000, j)) + + def run(self): + tdSql.prepare() + + self.insertData() + + tdSql.query("select count(*) val from st group by tbname") + tdSql.checkRows(10) + + tdSql.query("select * from (select count(*) val from st group by tbname)") + tdSql.checkRows(10) + + tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val < 20") + tdSql.checkRows(5) + + tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val > 20") + tdSql.checkRows(4) + + tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val = 20") + tdSql.checkRows(1) + + tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val <= 20") + tdSql.checkRows(6) + + tdSql.query("select * from (select count(*) val from st group by tbname) a where a.val >= 20") + tdSql.checkRows(5) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val > 20") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val >= 20") + tdSql.checkData(0, 0, 2) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val < 20") + tdSql.checkData(0, 0, 63) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val <= 20") + tdSql.checkData(0, 0, 64) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val = 20") + tdSql.checkData(0, 0, 1) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val > 20") + tdSql.checkData(0, 0, 1) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val >= 20") + tdSql.checkData(0, 0, 2) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val < 20") + tdSql.checkData(0, 0, 63) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val <= 20") + tdSql.checkData(0, 0, 64) + + tdSql.query("select count(*) from (select first(tagtype) val from st interval(30s)) a where a.val = 20") + tdSql.checkData(0, 0, 1) + + tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val > 20") + tdSql.checkData(0, 0, 3) + + tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val >= 20") + tdSql.checkData(0, 0, 5) + + tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val < 20") + tdSql.checkData(0, 0, 60) + + tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val <= 20") + tdSql.checkData(0, 0, 62) + + tdSql.query("select count(*) from (select last(tagtype) val from st interval(30s)) a where a.val = 20") + tdSql.checkData(0, 0, 2) + + + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index 7f7cb2a89e..cbe80882fb 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -2,38 +2,38 @@ ulimit -c unlimited # insert -python3.8 ./test.py $1 -f insert/basic.py -python3.8 ./test.py $1 -s && sleep 1 -python3.8 ./test.py $1 -f insert/bigint.py -python3.8 ./test.py $1 -s && sleep 1 -python3.8 ./test.py $1 -f insert/nchar.py -python3.8 ./test.py $1 -s && sleep 1 -python3.8 ./test.py $1 -f insert/multi.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/basic.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/bigint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/nchar.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/multi.py +python3 ./test.py $1 -s && sleep 1 # table -python3.8 ./test.py $1 -f table/column_name.py -python3.8 ./test.py $1 -s && sleep 1 -python3.8 ./test.py $1 -f table/column_num.py -python3.8 ./test.py $1 -s && sleep 1 -python3.8 ./test.py $1 -f table/db_table.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f table/column_name.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f table/column_num.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f table/db_table.py +python3 ./test.py $1 -s && sleep 1 # import -python3.8 ./test.py $1 -f import_merge/importDataLastSub.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastSub.py +python3 ./test.py $1 -s && sleep 1 #tag -python3.8 ./test.py $1 -f tag_lite/filter.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f tag_lite/filter.py +python3 ./test.py $1 -s && sleep 1 #query -python3.8 ./test.py $1 -f query/filter.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f query/filter.py +python3 ./test.py $1 -s && sleep 1 # client -python3.8 ./test.py $1 -f client/client.py -python3.8 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f client/client.py +python3 ./test.py $1 -s && sleep 1 # connector -python3.8 ./test.py $1 -f connector/lua.py +python3 ./test.py $1 -f connector/lua.py diff --git a/tests/pytest/stream/table_1.py b/tests/pytest/stream/table_1.py index a9fd573931..b205491fad 100644 --- a/tests/pytest/stream/table_1.py +++ b/tests/pytest/stream/table_1.py @@ -51,7 +51,7 @@ class TDTestCase: tdSql.execute( "insert into tb%d values (now - %dm, %d, %d)" % (i, 1440 - j, j, j)) - time.sleep(0.1) + time.sleep(1) self.createFuncStream("count(*)", "c1", rowNum) self.createFuncStream("count(tbcol)", "c2", rowNum) diff --git a/tests/pytest/table/tablename-boundary.py b/tests/pytest/table/tablename-boundary.py index 0755e75355..dc22c3343b 100644 --- a/tests/pytest/table/tablename-boundary.py +++ b/tests/pytest/table/tablename-boundary.py @@ -14,6 +14,13 @@ class TDTestCase: tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) + self.ts = 1622100000000 + + def get_random_string(self, length): + letters = string.ascii_lowercase + result_str = ''.join(random.choice(letters) for i in range(length)) + return result_str + def run(self): tdSql.prepare() @@ -24,19 +31,62 @@ class TDTestCase: shell=True)) - 1 tdLog.info("table name max length is %d" % tableNameMaxLen) chars = string.ascii_uppercase + string.ascii_lowercase - tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) + tb_name = ''.join(random.choices(chars, k=tableNameMaxLen + 1)) tdLog.info('tb_name length %d' % len(tb_name)) tdLog.info('create table %s (ts timestamp, value int)' % tb_name) - tdSql.error( - 'create table %s (ts timestamp, speed binary(4089))' % - tb_name) + tdSql.error('create table %s (ts timestamp, speed binary(4089))' % tb_name) - tb_name = ''.join(random.choices(chars, k=191)) + tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) tdLog.info('tb_name length %d' % len(tb_name)) tdLog.info('create table %s (ts timestamp, value int)' % tb_name) tdSql.execute( 'create table %s (ts timestamp, speed binary(4089))' % tb_name) + + db_name = self.get_random_string(33) + tdSql.error("create database %s" % db_name) + + db_name = self.get_random_string(32) + tdSql.execute("create database %s" % db_name) + tdSql.execute("use %s" % db_name) + + tb_name = self.get_random_string(193) + tdSql.error("create table %s(ts timestamp, val int)" % tb_name) + + tb_name = self.get_random_string(192) + tdSql.execute("create table %s.%s(ts timestamp, val int)" % (db_name, tb_name)) + tdSql.query("show %s.tables" % db_name) + tdSql.checkRows(1) + tdSql.checkData(0, 0, tb_name) + + tdSql.execute("insert into %s.%s values(now, 1)" % (db_name, tb_name)) + tdSql.query("select * from %s.%s" %(db_name, tb_name)) + tdSql.checkRows(1) + + db_name = self.get_random_string(32) + tdSql.execute("create database %s update 1" % db_name) + + stb_name = self.get_random_string(192) + tdSql.execute("create table %s.%s(ts timestamp, val int) tags(id int)" % (db_name, stb_name)) + tb_name1 = self.get_random_string(192) + tdSql.execute("insert into %s.%s using %s.%s tags(1) values(%d, 1)(%d, 2)(%d, 3)" % (db_name, tb_name1, db_name, stb_name, self.ts, self.ts + 1, self.ts + 2)) + tb_name2 = self.get_random_string(192) + tdSql.execute("insert into %s.%s using %s.%s tags(2) values(%d, 1)(%d, 2)(%d, 3)" % (db_name, tb_name2, db_name, stb_name, self.ts, self.ts + 1, self.ts + 2)) + + tdSql.query("show %s.tables" % db_name) + tdSql.checkRows(2) + + tdSql.query("select * from %s.%s" % (db_name, stb_name)) + tdSql.checkRows(6) + + tdSql.execute("insert into %s.%s using %s.%s tags(1) values(%d, null)" % (db_name, tb_name1, db_name, stb_name, self.ts)) + + tdSql.query("select * from %s.%s" % (db_name, stb_name)) + tdSql.checkRows(6) + + + + def stop(self): tdSql.close() diff --git a/tests/pytest/tag_lite/3.py b/tests/pytest/tag_lite/3.py index 373db1c70f..bbdf0868fa 100644 --- a/tests/pytest/tag_lite/3.py +++ b/tests/pytest/tag_lite/3.py @@ -60,14 +60,14 @@ class TDTestCase: x = 0 while (x < rowNum): - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 + # TSIM: sql insert into $tb values (1605045600000 + $ms , $x ) tdLog.info( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) x = x + 1 # TSIM: endw i = i + 1 @@ -81,13 +81,13 @@ class TDTestCase: (tb, mt)) x = 0 while (x < rowNum): - ms = "%dm" % x + ms = x * 60000 tdLog.info( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) x = x + 1 # TSIM: endw i = i + 1 @@ -104,36 +104,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from %s where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % mt) - tdSql.query('select * from %s where ts < now + 4m' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % mt) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % mt) - tdSql.query('select * from %s where ts > now + 4m' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % mt) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % mt) - tdSql.query('select * from %s where ts = now + 4m' % mt) + # TSIM: sql select * from %s where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % mt) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % mt) tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) @@ -267,91 +267,91 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = true + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = true' % mt) tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> true + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> true' % mt) tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = false + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = false' % mt) tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> false + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> false' % mt) tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = false + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = false' % mt) tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> false + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> false' % mt) tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> false - # and ts < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> false + # and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> false and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> false and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -361,84 +361,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -448,84 +448,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -535,104 +535,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol1 = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = true' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol1 <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> true' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol1 <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol1 <> false + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -642,104 +642,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol1 = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol1 = true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol1 = true' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol1 <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol1 <> true' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol1 <> true' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol1 = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol1 <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol1 = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol1 <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol1 <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol1 <> false' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol1 <> false + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> false' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -749,104 +749,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -856,104 +856,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1034,12 +1034,12 @@ class TDTestCase: # TSIM: print =============== step15 tdLog.info('=============== step15') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1050,13 +1050,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1067,13 +1067,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true and tgcol2 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1084,11 +1084,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1204,13 +1204,13 @@ class TDTestCase: # TSIM: print =============== step18 tdLog.info('=============== step18') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 # group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1221,13 +1221,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1238,11 +1238,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true and tgcol2 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1253,10 +1253,10 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then diff --git a/tests/pytest/tag_lite/4.py b/tests/pytest/tag_lite/4.py index aae930ecdf..df81dd8100 100644 --- a/tests/pytest/tag_lite/4.py +++ b/tests/pytest/tag_lite/4.py @@ -64,14 +64,14 @@ class TDTestCase: (tb, mt)) x = 0 while (x < rowNum): - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 + # TSIM: sql insert into $tb values (1605045600000 + $ms , $x ) tdLog.info( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) x = x + 1 # TSIM: endw i = i + 1 @@ -87,14 +87,13 @@ class TDTestCase: (tb, mt)) x = 0 while (x < rowNum): - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - "insert into %s values (now + %s, %d)" % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) x = x + 1 # TSIM: endw i = i + 1 @@ -111,36 +110,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from %s where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % mt) - tdSql.query('select * from %s where ts < now + 4m' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % mt) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % mt) - tdSql.query('select * from %s where ts > now + 4m' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % mt) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % mt) - tdSql.query('select * from %s where ts = now + 4m' % mt) + # TSIM: sql select * from %s where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % mt) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % mt) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -322,84 +321,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol1 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol1 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol1 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol1 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol1 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -409,84 +408,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol2 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -496,84 +495,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol3 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -583,84 +582,84 @@ class TDTestCase: # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol4 = 1' % mt) - tdSql.query('select * from %s where ts > now + 4m and tgcol4 = 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % mt) + tdSql.query('select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol4 <> 1' % mt) + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) - tdSql.query('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % mt) + tdSql.query('select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol4 <> 0' % mt) + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 - tdLog.info('select * from %s where ts <= now + 4m and tgcol4 = 0' % mt) + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts - # < now + 5m + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -670,104 +669,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol1 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -777,104 +776,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol1 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol1 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol1 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol1 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol1 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -884,104 +883,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -991,104 +990,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol4 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1098,104 +1097,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1205,104 +1204,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1312,105 +1311,105 @@ class TDTestCase: # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % mt) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts - # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts + # < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % mt) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1508,12 +1507,12 @@ class TDTestCase: # TSIM: print =============== step20 tdLog.info('=============== step20') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1524,13 +1523,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1541,13 +1540,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1558,13 +1557,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1575,10 +1574,10 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -1722,13 +1721,13 @@ class TDTestCase: # TSIM: print =============== step23 tdLog.info('=============== step23') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 # group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1739,13 +1738,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1756,11 +1755,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % mt) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1771,10 +1770,10 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -1784,11 +1783,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and + # max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and # tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by # tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % mt) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then diff --git a/tests/pytest/tag_lite/5.py b/tests/pytest/tag_lite/5.py index b3608bebee..28c8fc125a 100644 --- a/tests/pytest/tag_lite/5.py +++ b/tests/pytest/tag_lite/5.py @@ -76,14 +76,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s, %d)' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s, %d)' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -105,14 +104,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s, %d)' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s, %d)' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -131,36 +129,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -377,98 +375,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -478,98 +476,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -579,98 +577,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -680,98 +678,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -781,98 +779,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -882,104 +880,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -989,104 +987,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1096,104 +1094,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1203,104 +1201,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 = 1 and # tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 1 and # tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol5 <> 0 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1310,104 +1308,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1417,104 +1415,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1524,105 +1522,105 @@ class TDTestCase: # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1632,106 +1630,106 @@ class TDTestCase: # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1844,12 +1842,12 @@ class TDTestCase: # TSIM: print =============== step23 tdLog.info('=============== step23') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1860,13 +1858,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1877,13 +1875,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1894,13 +1892,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1911,11 +1909,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -1926,11 +1924,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2106,13 +2104,13 @@ class TDTestCase: # TSIM: print =============== step26 tdLog.info('=============== step26') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2123,13 +2121,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2140,13 +2138,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2157,11 +2155,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2172,11 +2170,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by # tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2186,11 +2184,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then diff --git a/tests/pytest/tag_lite/6.py b/tests/pytest/tag_lite/6.py index b789e41794..5cf43f1047 100644 --- a/tests/pytest/tag_lite/6.py +++ b/tests/pytest/tag_lite/6.py @@ -79,14 +79,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -110,14 +109,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -136,36 +134,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -417,98 +415,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -518,98 +516,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -619,98 +617,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -720,98 +718,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -821,98 +819,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -922,98 +920,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol6 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol6 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol6 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol6 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol6 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol6 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol6 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol6 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol6 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol6 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol6 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1023,104 +1021,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol1 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1130,104 +1128,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1237,104 +1235,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 = 1 and # tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 = 1 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 1 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol3 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol3 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol3 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1344,104 +1342,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 = 1 and # tgcol4 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol4 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 1 and # tgcol4 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol4 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol4 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol4 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol5 <> 0 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol4 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1451,104 +1449,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 = 1 and # tgcol6 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol6 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 = 1 and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 = 1 and tgcol6 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 1 and # tgcol6 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol6 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 1 and tgcol6 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 = 0 and # tgcol6 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 = 0 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 = 0 and # tgcol6 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 = 0 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol5 <> 0 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol6 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol5 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol5 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1558,104 +1556,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol1 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol1 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1665,104 +1663,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step21 tdLog.info('=============== step21') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1772,105 +1770,105 @@ class TDTestCase: # TSIM: # TSIM: print =============== step22 tdLog.info('=============== step22') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1880,106 +1878,106 @@ class TDTestCase: # TSIM: # TSIM: print =============== step23 tdLog.info('=============== step23') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -1989,112 +1987,112 @@ class TDTestCase: # TSIM: # TSIM: print =============== step24 tdLog.info('=============== step24') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 = 1 and # tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = # 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and # tgcol6 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = # 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = # 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol4 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol4 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -2221,12 +2219,12 @@ class TDTestCase: # TSIM: print =============== step27 tdLog.info('=============== step27') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2237,13 +2235,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2254,13 +2252,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2271,13 +2269,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2288,11 +2286,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2303,11 +2301,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2317,11 +2315,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 and tgcol6 = 1 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2527,13 +2525,13 @@ class TDTestCase: # TSIM: print =============== step30 tdLog.info('=============== step30') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2544,13 +2542,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2561,13 +2559,13 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2578,11 +2576,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -2593,11 +2591,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by # tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2607,11 +2605,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then @@ -2621,11 +2619,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and # tgcol5 = 1 and tgcol6 = 1 group by tgcol2 - tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) - tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) + tdLog.info('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) + tdSql.query('select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') # TSIM: if $data00 != 25 then diff --git a/tests/pytest/tag_lite/bigint.py b/tests/pytest/tag_lite/bigint.py index f83961aaad..733d30983d 100644 --- a/tests/pytest/tag_lite/bigint.py +++ b/tests/pytest/tag_lite/bigint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/binary.py b/tests/pytest/tag_lite/binary.py index 4cbae63bec..3825c6637f 100644 --- a/tests/pytest/tag_lite/binary.py +++ b/tests/pytest/tag_lite/binary.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,98 +331,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '0' and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -471,12 +469,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -526,13 +524,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/binary_binary.py b/tests/pytest/tag_lite/binary_binary.py index 9c789eafd6..2a76238f59 100644 --- a/tests/pytest/tag_lite/binary_binary.py +++ b/tests/pytest/tag_lite/binary_binary.py @@ -74,14 +74,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -102,14 +101,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -128,36 +126,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -269,98 +267,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> '0' and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> "0" and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -370,98 +368,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -471,104 +469,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and # tgcol = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and # tgcol <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and # tgcol <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' # and tgcol <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' and tgcol <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m and ts < now + 5m and tgcol <> '0' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -648,12 +646,12 @@ class TDTestCase: # TSIM: print =============== step10 tdLog.info('=============== step10') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -738,13 +736,13 @@ class TDTestCase: # TSIM: print =============== step13 tdLog.info('=============== step13') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/bool.py b/tests/pytest/tag_lite/bool.py index 6f2afd2625..11ce9eb7f8 100644 --- a/tests/pytest/tag_lite/bool.py +++ b/tests/pytest/tag_lite/bool.py @@ -71,14 +71,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -97,14 +96,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -123,81 +121,81 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -216,36 +214,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -324,98 +322,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false - # and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false + # and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -462,12 +460,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -517,13 +515,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/bool_binary.py b/tests/pytest/tag_lite/bool_binary.py index bfc496e8e4..934d91c908 100644 --- a/tests/pytest/tag_lite/bool_binary.py +++ b/tests/pytest/tag_lite/bool_binary.py @@ -71,14 +71,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -96,14 +95,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -122,36 +120,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -263,98 +261,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false - # and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false + # and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -364,98 +362,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -465,104 +463,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and # tgcol = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and # tgcol <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and # tgcol <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' # and tgcol <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' and tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m and ts < now + 5m and tgcol <> false + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -642,12 +640,12 @@ class TDTestCase: # TSIM: print =============== step10 tdLog.info('=============== step10') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -732,13 +730,13 @@ class TDTestCase: # TSIM: print =============== step13 tdLog.info('=============== step13') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/bool_int.py b/tests/pytest/tag_lite/bool_int.py index f7bfc7acef..1e857192ed 100644 --- a/tests/pytest/tag_lite/bool_int.py +++ b/tests/pytest/tag_lite/bool_int.py @@ -71,14 +71,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -96,14 +95,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -122,36 +120,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -295,98 +293,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false - # and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> false + # and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> false and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> false and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -396,98 +394,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -497,104 +495,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol = true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol <> true tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> true' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> true' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> true' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol = false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol <> false tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol = false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol <> false tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> false' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol <> false + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> false' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -674,12 +672,12 @@ class TDTestCase: # TSIM: print =============== step10 tdLog.info('=============== step10') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -764,13 +762,13 @@ class TDTestCase: # TSIM: print =============== step13 tdLog.info('=============== step13') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/double.py b/tests/pytest/tag_lite/double.py index b1f29f592e..c9d3a5af9e 100644 --- a/tests/pytest/tag_lite/double.py +++ b/tests/pytest/tag_lite/double.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/drop_auto_create.py b/tests/pytest/tag_lite/drop_auto_create.py new file mode 100644 index 0000000000..f89b41008b --- /dev/null +++ b/tests/pytest/tag_lite/drop_auto_create.py @@ -0,0 +1,47 @@ +################################################################### +# 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 +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdSql.execute('create table m1(ts timestamp, k int) tags(a binary(12), b int, c double);') + tdSql.execute('insert into tm0 using m1(b,c) tags(1, 99) values(now, 1);') + tdSql.execute('insert into tm1 using m1(b,c) tags(2, 100) values(now, 2);') + tdLog.info("2 rows inserted") + tdSql.query('select * from m1;') + tdSql.checkRows(2) + tdSql.query('select *,tbname from m1;') + tdSql.execute("drop table tm0; ") + tdSql.query('select * from m1') + tdSql.checkRows(1) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/float.py b/tests/pytest/tag_lite/float.py index 7b93cb0ac9..589df89ab9 100644 --- a/tests/pytest/tag_lite/float.py +++ b/tests/pytest/tag_lite/float.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/int.py b/tests/pytest/tag_lite/int.py index d5a6917389..1297d083a0 100644 --- a/tests/pytest/tag_lite/int.py +++ b/tests/pytest/tag_lite/int.py @@ -71,14 +71,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -97,14 +96,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -123,56 +121,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -189,25 +187,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -226,36 +224,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -332,94 +330,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -466,12 +464,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -521,13 +519,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/int_binary.py b/tests/pytest/tag_lite/int_binary.py index 7760814f66..6ce9a9a431 100644 --- a/tests/pytest/tag_lite/int_binary.py +++ b/tests/pytest/tag_lite/int_binary.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,36 +122,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -265,94 +263,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -362,98 +360,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1"' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0"' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0"' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -463,104 +461,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = '1' and # tgcol = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = "1" and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = "1" and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '1' and # tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "1" and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "1" and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = "0" and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> '0' and # tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = '0' and # tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = "0" and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = "0" and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> '0' # and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> '0' and tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> "0" and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> "0" and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and - # ts < now + 5m and ts < now + 5m and tgcol <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> '0' and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> "0" and ts < now + 5m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> "0" and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -640,12 +638,12 @@ class TDTestCase: # TSIM: print =============== step10 tdLog.info('=============== step10') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -730,13 +728,13 @@ class TDTestCase: # TSIM: print =============== step13 tdLog.info('=============== step13') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/int_float.py b/tests/pytest/tag_lite/int_float.py index 31c94130ab..341acfd5ae 100644 --- a/tests/pytest/tag_lite/int_float.py +++ b/tests/pytest/tag_lite/int_float.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,36 +122,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -301,94 +299,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -398,98 +396,98 @@ class TDTestCase: # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -499,104 +497,104 @@ class TDTestCase: # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 = 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 = 1 and # tgcol = 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 = 1 and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 = 1 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 1 and # tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 1 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 = 0 and # tgcol = 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 = 0 and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 = 0 and # tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 = 0 and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 = 0 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol2 <> 0 and tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol2 <> 0 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and - # ts < now + 5m and ts < now + 5m and tgcol <> 0 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol2 <> 0 and + # ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol2 <> 0 and ts < 1605045600000 + 300001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -676,12 +674,12 @@ class TDTestCase: # TSIM: print =============== step10 tdLog.info('=============== step10') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -766,13 +764,13 @@ class TDTestCase: # TSIM: print =============== step13 tdLog.info('=============== step13') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/smallint.py b/tests/pytest/tag_lite/smallint.py index c060e3f82b..93fde22ca9 100644 --- a/tests/pytest/tag_lite/smallint.py +++ b/tests/pytest/tag_lite/smallint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/timestamp.py b/tests/pytest/tag_lite/timestamp.py new file mode 100644 index 0000000000..fa71c2e154 --- /dev/null +++ b/tests/pytest/tag_lite/timestamp.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdLog.info('======================== dnode1 start') + tbPrefix = "ta_fl_tb" + mtPrefix = "ta_fl_mt" + tbNum = 10 + rowNum = 20 + totalNum = 200 + tdLog.info('=============== step1') + i = 0 + mt = "%s%d" % (mtPrefix, i) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float, tgTs timestamp, tgcol2 int)' %(mt)) + i = 0 + ts = 1605045600000 + tsStr = "2020-11-11 06:00:00" + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + tdLog.info('create table %s using %s tags(%d, %d, %d)' % (tb, mt, i, ts + i, i)) + tdSql.execute('create table %s using %s tags(%d, %d, %d)' % (tb, mt, i, ts + i, i)) + x = 0 + while (x < rowNum): + ms = x * 60000 + #tdLog.info( + # "insert into %s values (%d, %d)" % + # (tb, 1605045600000 + ms, x)) + tdSql.execute( + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) + x = x + 1 + i = i + 1 + tdLog.info('=============== step2') + tdSql.query('select * from %s' % (mt)) + tdSql.checkRows(5 * rowNum) + + tdSql.query('select * from %s where tgTs = %ld and tgcol2 = 0' % (mt, ts)) + tdSql.checkRows(rowNum) + + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 0' % (mt, tsStr)) + tdSql.checkRows(rowNum) + + tdLog.info('=============== step3') + i = 0 + while (i < 5): + tb = "%s%d" % (tbPrefix, i + 100) + tdLog.info('create table %s using %s tags(%d, \"%s\", %d)' % (tb, mt, i + 100, tsStr, i + 100)) + tdSql.execute('create table %s using %s tags(%d, \"%s\", %d)' % (tb, mt, i + 100, tsStr, i + 100)) + x = 0 + while (x < rowNum): + ms = x * 60000 + #tdLog.info( + # "insert into %s values (%d, %d)" % + # (tb, 1605045600000 + ms, x)) + tdSql.execute( + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) + x = x + 1 + i = i + 1 + + tdSql.query('select * from %s where tgTs = %ld and tgcol2 = 100' % (mt, ts)) + tdSql.checkRows(rowNum) + + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 100' % (mt, tsStr)) + tdSql.checkRows(rowNum) + + tdLog.info('=============== step4') + + i = 0 + tb = "%s%d"%(tbPrefix, i + 1000) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+2s, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+3s, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 1000' % (mt, tsStr)) + tdSql.checkRows(3) + + i = 0 + tb = "%s%d"%(tbPrefix, i + 10000) + tdSql.execute('create table %s using %s tags(%d, now, %d)' % (tb, mt, i + 10000,i + 10000)) + tdSql.checkRows(3) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tag_lite/tinyint.py b/tests/pytest/tag_lite/tinyint.py index 089dd46569..fc4af4ee96 100644 --- a/tests/pytest/tag_lite/tinyint.py +++ b/tests/pytest/tag_lite/tinyint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/unsignedBigint.py b/tests/pytest/tag_lite/unsignedBigint.py index 032dacd366..6a33812f88 100644 --- a/tests/pytest/tag_lite/unsignedBigint.py +++ b/tests/pytest/tag_lite/unsignedBigint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/unsignedInt.py b/tests/pytest/tag_lite/unsignedInt.py index 6efe12edf1..6e741d351a 100644 --- a/tests/pytest/tag_lite/unsignedInt.py +++ b/tests/pytest/tag_lite/unsignedInt.py @@ -4,7 +4,7 @@ import sys from util.log import * from util.cases import * from util.sql import * - +import time class TDTestCase: def init(self, conn, logSql): @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -114,6 +112,7 @@ class TDTestCase: # TSIM: endw # TSIM: # TSIM: print =============== step2 + time.sleep(1) tdLog.info('=============== step2') # TSIM: sleep 100 # TSIM: sql select * from $tb @@ -124,56 +123,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +189,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +226,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +332,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +466,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +521,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/unsignedSmallint.py b/tests/pytest/tag_lite/unsignedSmallint.py index 59cb33dc18..21c390d9dc 100644 --- a/tests/pytest/tag_lite/unsignedSmallint.py +++ b/tests/pytest/tag_lite/unsignedSmallint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tag_lite/unsignedTinyint.py b/tests/pytest/tag_lite/unsignedTinyint.py index 1250b08d1b..7ce3a83984 100644 --- a/tests/pytest/tag_lite/unsignedTinyint.py +++ b/tests/pytest/tag_lite/unsignedTinyint.py @@ -72,14 +72,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -98,14 +97,13 @@ class TDTestCase: # TSIM: while $x < $rowNum while (x < rowNum): # TSIM: $ms = $x . m - ms = "%dm" % x - # TSIM: sql insert into $tb values (now + $ms , $x ) + ms = x * 60000 tdLog.info( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) tdSql.execute( - 'insert into %s values (now + %s , %d )' % - (tb, ms, x)) + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) # TSIM: $x = $x + 1 x = x + 1 # TSIM: endw @@ -124,56 +122,56 @@ class TDTestCase: tdSql.checkRows(rowNum) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (tb)) - tdSql.query('select * from %s where ts < now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts <= now + 4m - tdLog.info('select * from %s where ts <= now + 4m' % (tb)) - tdSql.query('select * from %s where ts <= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts <= 1605045600000 + 240001 + tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (tb)) - tdSql.query('select * from %s where ts > now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts >= now + 4m - tdLog.info('select * from %s where ts >= now + 4m' % (tb)) - tdSql.query('select * from %s where ts >= now + 4m' % (tb)) + # TSIM: sql select * from $tb where ts >= 1605045600000 + 240001 + tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb)) + tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb)) # TSIM: if $rows != 15 then tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m + # TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) tdSql.query( - 'select * from %s where ts < now + 4m and ts > now + 5m' % + 'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') @@ -190,25 +188,25 @@ class TDTestCase: tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 3m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' % (tb)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and - # ts < now + 6m + # TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and + # ts < 1605045600000 + 360001 tdLog.info( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) tdSql.query( - 'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' % (tb)) # TSIM: if $rows != 1 then tdLog.info('tdSql.checkRow(1)') @@ -227,36 +225,36 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: - # TSIM: sql select * from $mt where ts < now + 4m - tdLog.info('select * from %s where ts < now + 4m' % (mt)) - tdSql.query('select * from %s where ts < now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 + tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 50 then tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m - tdLog.info('select * from %s where ts > now + 4m' % (mt)) - tdSql.query('select * from %s where ts > now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 + tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 150 then tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts = now + 4m - tdLog.info('select * from %s where ts = now + 4m' % (mt)) - tdSql.query('select * from %s where ts = now + 4m' % (mt)) + # TSIM: sql select * from $mt where ts = 1605045600000 + 240001 + tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt)) + tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt)) # TSIM: if $rows != 0 then tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 10 then tdLog.info('tdSql.checkRow(10)') @@ -333,94 +331,94 @@ class TDTestCase: # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') - # TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1 - tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt)) + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1 + tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol = 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 1' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' % (mt)) # TSIM: if $rows != 75 then tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 - tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0 + tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol = 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts < now + 4m and tgcol <> 0' % + 'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol = 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 + # TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0 tdLog.info( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts <= now + 4m and tgcol <> 0' % + 'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 25 then tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and # tgcol <> 0 tdLog.info( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' % + 'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 # TSIM: endi - # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts - # < now + 5m + # TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts + # < 1605045600000 + 300001 tdLog.info( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) tdSql.query( - 'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' % + 'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' % (mt)) # TSIM: if $rows != 5 then tdLog.info('tdSql.checkRow(5)') @@ -467,12 +465,12 @@ class TDTestCase: # TSIM: print =============== step8 tdLog.info('=============== step8') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') @@ -522,13 +520,13 @@ class TDTestCase: # TSIM: print =============== step11 tdLog.info('=============== step11') # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), - # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m + # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001 # group by tgcol tdLog.info( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) tdSql.query( - 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' % + 'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' % (mt)) # TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06 tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06') diff --git a/tests/pytest/tools/taosdemoAllTest/sub.json b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfter1.json similarity index 59% rename from tests/pytest/tools/taosdemoAllTest/sub.json rename to tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfter1.json index fe3c892a76..93462d2c66 100644 --- a/tests/pytest/tools/taosdemoAllTest/sub.json +++ b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfter1.json @@ -9,29 +9,33 @@ "confirm_parameter_prompt": "no", "specified_table_query": { - "concurrent":1, + "concurrent":2, "mode":"sync", "interval":0, - "restart":"yes", + "resubAfterConsume":1, + "endAfterConsume":1, "keepProgress":"yes", + "restart":"no", "sqls": [ { - "sql": "select * from stb00_0 ;", + "sql": "select * from stb00_0", "result": "./subscribe_res0.txt" }] }, "super_table_query": { "stblname": "stb0", - "threads":1, + "threads":2, "mode":"sync", - "interval":10000, - "restart":"yes", + "interval":1000, + "resubAfterConsume":1, + "endAfterConsume":1, "keepProgress":"yes", + "restart":"no", "sqls": [ { - "sql": "select * from xxxx where ts > '2021-02-25 11:35:00.000' ;", - "result": "./subscribe_res1.txt" + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" }] } } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfterMin1.json b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfterMin1.json new file mode 100644 index 0000000000..4229f304e4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubAC1endAfterMin1.json @@ -0,0 +1,41 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "resubAfterConsume":1, + "endAfterConsume":-1, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":1000, + "resubAfterConsume":1, + "endAfterConsume":-1, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1.json b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1.json new file mode 100644 index 0000000000..ac22190565 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1.json @@ -0,0 +1,41 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "resubAfterConsume":-1, + "endAfterConsume":-1, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":1000, + "resubAfterConsume":-1, + "endAfterConsume":-1, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfter0.json b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfter0.json new file mode 100644 index 0000000000..7d937212c9 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfter0.json @@ -0,0 +1,41 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "resubAfterConsume":-1, + "endAfterConsume":0, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":0, + "resubAfterConsume":-1, + "endAfterConsume":0, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfterNo0.json b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfterNo0.json new file mode 100644 index 0000000000..bf8927a58b --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfterNo0.json @@ -0,0 +1,41 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "resubAfterConsume":-1, + "endAfterConsume":1, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":1000, + "resubAfterConsume":-1, + "endAfterConsume":2, + "keepProgress":"no", + "restart":"yes", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.py b/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.py index 1401716da9..fe29409f29 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.py +++ b/tests/pytest/tools/taosdemoAllTest/TD-3453/query-interrupt.py @@ -78,7 +78,7 @@ class TDTestCase: tdSql.checkData(0, 0, "%d" % suc_kill) os.system("rm -rf querySystemInfo*") os.system("rm -rf insert_res.txt") - os.system("rm -rf insert_res.txt") + os.system("rm -rf query_res.txt") def stop(self): tdSql.close() diff --git a/tests/pytest/tools/taosdemoAllTest/TD-3453/queryall.json b/tests/pytest/tools/taosdemoAllTest/TD-3453/queryall.json index a92906fa73..62b6e7472a 100644 --- a/tests/pytest/tools/taosdemoAllTest/TD-3453/queryall.json +++ b/tests/pytest/tools/taosdemoAllTest/TD-3453/queryall.json @@ -13,7 +13,7 @@ "sqls":[ { "sql": "select * from stb0", - "result": "" + "result": "./query_res.txt" } ] } diff --git a/tests/pytest/tools/taosdemoAllTest/convertResFile.py b/tests/pytest/tools/taosdemoAllTest/convertResFile.py index 52bb8f40d0..5ed2fec13b 100644 --- a/tests/pytest/tools/taosdemoAllTest/convertResFile.py +++ b/tests/pytest/tools/taosdemoAllTest/convertResFile.py @@ -2,6 +2,14 @@ from datetime import datetime import time import os +# class FileSeparaSpaceConvertcomma: +# def __init__(self): +# self.inputfile = "" +# self.oputfile = "" +# self.affectedRows = 0 + +# def ConvertFile(self, inputfile,): + os.system("awk -v OFS=',' '{$1=$1;print$0}' ./all_query_res0.txt > ./new_query_res0.txt") with open('./new_query_res0.txt','r+') as f0: contents = f0.readlines() diff --git a/tests/pytest/tools/taosdemoAllTest/insert-disorder.json b/tests/pytest/tools/taosdemoAllTest/insert-disorder.json index f2dca662fd..0ae3a7194f 100644 --- a/tests/pytest/tools/taosdemoAllTest/insert-disorder.json +++ b/tests/pytest/tools/taosdemoAllTest/insert-disorder.json @@ -8,7 +8,7 @@ "thread_count": 4, "thread_count_create_tbl": 4, "result_file":"./insert_res.txt", - "confirm_parameter_prompt": "no", + "confirm_parameter_prompt": "no", "insert_interval": 0, "interlace_rows": 10, "num_of_records_per_req": 1000, diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json new file mode 100644 index 0000000000..3ac8882699 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-N00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json new file mode 100644 index 0000000000..ffa1c91b82 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json @@ -0,0 +1,181 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json index 55be019891..cd69badad1 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json +++ b/tests/pytest/tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json @@ -71,7 +71,7 @@ "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", - "interlace_rows": 1000000, + "interlace_rows": 0, "insert_interval":0, "max_sql_len": 1024000, "disorder_ratio": 0, @@ -97,7 +97,7 @@ "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", - "interlace_rows": 1000000, + "interlace_rows": 0, "insert_interval":0, "max_sql_len": 1024000, "disorder_ratio": 0, @@ -123,7 +123,7 @@ "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", - "interlace_rows": 1000000, + "interlace_rows": 100, "insert_interval":0, "max_sql_len": 1024000, "disorder_ratio": 0, diff --git a/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json b/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json new file mode 100644 index 0000000000..1b56830189 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json @@ -0,0 +1,62 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 1000, + "max_sql_len": 10240000000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1000, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1004}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":7}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json b/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json new file mode 100644 index 0000000000..91234d5e48 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertMaxNumPerReq.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 50000, + "num_of_records_per_req": 50000, + "max_sql_len": 1025000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows":50000, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 32767, + "insert_interval":0, + "max_sql_len": 1025000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2012-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "TINYINT", "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertRestful.json b/tests/pytest/tools/taosdemoAllTest/insertRestful.json new file mode 100644 index 0000000000..d05e1c249f --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insertRestful.json @@ -0,0 +1,88 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "rest", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json b/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json index 5cf8114472..88218b4989 100644 --- a/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json +++ b/tests/pytest/tools/taosdemoAllTest/insertTagsNumLarge128.json @@ -11,8 +11,8 @@ "confirm_parameter_prompt": "no", "insert_interval": 0, "interlace_rows": 10, - "num_of_records_per_req": 100, - "max_sql_len": 10240000000, + "num_of_records_per_req": 1000000, + "max_sql_len": 1024000000, "databases": [{ "dbinfo": { "name": "db1", @@ -45,7 +45,7 @@ "childtable_limit": 0, "childtable_offset":0, "multi_thread_write_one_tbl": "no", - "interlace_rows": 0, + "interlace_rows": 10000, "insert_interval":0, "max_sql_len": 1024000, "disorder_ratio": 0, diff --git a/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json b/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json new file mode 100644 index 0000000000..4637009ca3 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert_5M_rows.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10000, + "childtable_limit": 10, + "childtable_offset":100, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json new file mode 100644 index 0000000000..a6ac674dd7 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_block1_comp.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 3, + "precision": "ms", + "keep": 3650, + "minRows": 1000, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 10000, + "childtable_limit": 10, + "childtable_offset":100, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2019-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_block2.json b/tests/pytest/tools/taosdemoAllTest/manual_block2.json new file mode 100644 index 0000000000..434159159b --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_block2.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 500, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100000, + "childtable_limit": 500, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_A.json b/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_A.json new file mode 100644 index 0000000000..7b8abd6d4e --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_A.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 1, + "cache": 4, + "blocks": 3, + "precision": "ms", + "keep": 10, + "minRows": 1000, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 864000, + "childtable_limit": 1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-11 00:00:00.000", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 5120, "count":1}], + "tags": [{"type": "TINYINT", "count":2}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_B.json b/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_B.json new file mode 100644 index 0000000000..aeee6322e5 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/manual_change_time_1_1_B.json @@ -0,0 +1,60 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 32766, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "replica": 1, + "days": 1, + "cache": 4, + "blocks": 3, + "precision": "ms", + "keep": 10, + "minRows": 1000, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 1, + "childtable_prefix": "stb_", + "auto_create_table": "yes", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 432000, + "childtable_limit": 1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-16 00:00:00.500", + "sample_format": "csv", + "sample_file": "./tools/taosdemoAllTest/sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 5120, "count":1}], + "tags": [{"type": "TINYINT", "count":1}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/moredemo-insert-offset.py b/tests/pytest/tools/taosdemoAllTest/moredemo-insert-offset.py index 703f755c31..077ced5d02 100644 --- a/tests/pytest/tools/taosdemoAllTest/moredemo-insert-offset.py +++ b/tests/pytest/tools/taosdemoAllTest/moredemo-insert-offset.py @@ -60,7 +60,7 @@ class TDTestCase: tdSql.checkData(0, 0, 1000000) os.system("rm -rf ./insert_res.txt") - os.system("rm -rf tools/taosdemoAllTest/taosdemoTestWithJson-1.py.sql") + os.system("rm -rf tools/taosdemoAllTest/moredemo-insert-offset.py.sql") def stop(self): diff --git a/tests/pytest/tools/taosdemoAllTest/querrThreads0.json b/tests/pytest/tools/taosdemoAllTest/querrThreads0.json new file mode 100644 index 0000000000..69557a7841 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/querrThreads0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times":3, + "specified_table_query": { + "query_interval": 0, + "concurrent": 1, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": 0, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/querrThreadsless0.json b/tests/pytest/tools/taosdemoAllTest/querrThreadsless0.json new file mode 100644 index 0000000000..9074ae8fd1 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/querrThreadsless0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times":3, + "specified_table_query": { + "query_interval": 0, + "concurrent": 1, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": -1, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/queryConcurrent0.json b/tests/pytest/tools/taosdemoAllTest/queryConcurrent0.json new file mode 100644 index 0000000000..fd047dec94 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/queryConcurrent0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times":3, + "specified_table_query": { + "query_interval": 0, + "concurrent": 0, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": 1, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/queryConcurrentless0.json b/tests/pytest/tools/taosdemoAllTest/queryConcurrentless0.json new file mode 100644 index 0000000000..96a54cfd09 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/queryConcurrentless0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times":3, + "specified_table_query": { + "query_interval": 0, + "concurrent": -1, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": 1, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/speciQueryInsertdata.json b/tests/pytest/tools/taosdemoAllTest/queryInsertdata.json similarity index 89% rename from tests/pytest/tools/taosdemoAllTest/speciQueryInsertdata.json rename to tests/pytest/tools/taosdemoAllTest/queryInsertdata.json index 79471be204..99138e3666 100644 --- a/tests/pytest/tools/taosdemoAllTest/speciQueryInsertdata.json +++ b/tests/pytest/tools/taosdemoAllTest/queryInsertdata.json @@ -35,7 +35,7 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 10, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 10, @@ -54,13 +54,13 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }, { "name": "stb1", "child_table_exists":"no", - "childtable_count": 100, + "childtable_count": 10, "childtable_prefix": "stb01_", "auto_create_table": "no", "batch_create_tbl_num": 10, @@ -79,7 +79,7 @@ "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 1, "count":3}, {"type": "BINARY", "len": 2, "count":6}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/queryInsertrestdata.json b/tests/pytest/tools/taosdemoAllTest/queryInsertrestdata.json new file mode 100644 index 0000000000..747f7b3c7e --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/queryInsertrestdata.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0 , + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 1, "count":3}, {"type": "BINARY", "len": 2, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/queryQps.json b/tests/pytest/tools/taosdemoAllTest/queryQps.json index 67a1cf3eb3..7ebad5e2b2 100644 --- a/tests/pytest/tools/taosdemoAllTest/queryQps.json +++ b/tests/pytest/tools/taosdemoAllTest/queryQps.json @@ -9,8 +9,8 @@ "databases": "db", "query_times": 1, "specified_table_query": { - "query_interval": 0, - "concurrent": 1, + "query_interval": 10000, + "concurrent": 4, "sqls": [ { "sql": "select last_row(*) from stb00_0", @@ -24,8 +24,8 @@ }, "super_table_query": { "stblname": "stb1", - "query_interval":0, - "threads": 1, + "query_interval":20000, + "threads": 4, "sqls": [ { "sql": "select last_row(ts) from xxxx", diff --git a/tests/pytest/tools/taosdemoAllTest/speciQueryRestful.json b/tests/pytest/tools/taosdemoAllTest/queryRestful.json similarity index 100% rename from tests/pytest/tools/taosdemoAllTest/speciQueryRestful.json rename to tests/pytest/tools/taosdemoAllTest/queryRestful.json diff --git a/tests/pytest/tools/taosdemoAllTest/speciQueryTaosc.json b/tests/pytest/tools/taosdemoAllTest/queryTaosc.json similarity index 100% rename from tests/pytest/tools/taosdemoAllTest/speciQueryTaosc.json rename to tests/pytest/tools/taosdemoAllTest/queryTaosc.json diff --git a/tests/pytest/tools/taosdemoAllTest/queryTimes0.json b/tests/pytest/tools/taosdemoAllTest/queryTimes0.json new file mode 100644 index 0000000000..63a1358772 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/queryTimes0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 0, + "specified_table_query": { + "query_interval": 0, + "concurrent": 1, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": 1, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/queryTimesless0.json b/tests/pytest/tools/taosdemoAllTest/queryTimesless0.json new file mode 100644 index 0000000000..039f7e1060 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/queryTimesless0.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": -1, + "specified_table_query": { + "query_interval": 0, + "concurrent": 1, + "sqls": [ + { + "sql": "select last_row(*) from stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from stb00_99 ", + "result": "./query_res1.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":0, + "threads": 1, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subAsync.json b/tests/pytest/tools/taosdemoAllTest/subAsync.json new file mode 100644 index 0000000000..67a3bf5aab --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subAsync.json @@ -0,0 +1,45 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"async", + "interval":0, + "restart":"yes", + "keepProgress":"yes", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select ts from stb00_1", + "result": "./subscribe_res1.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"async", + "interval":0, + "restart":"yes", + "keepProgress":"yes", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }, + { + "sql": "select * from xxxx where ts > '2021-02-25 10:00:04.000' ", + "result": "./subscribe_res3.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subInsertdata.json b/tests/pytest/tools/taosdemoAllTest/subInsertdata.json index 7d14d0ad4b..1f9d794990 100644 --- a/tests/pytest/tools/taosdemoAllTest/subInsertdata.json +++ b/tests/pytest/tools/taosdemoAllTest/subInsertdata.json @@ -35,26 +35,26 @@ "super_tables": [{ "name": "stb0", "child_table_exists":"no", - "childtable_count": 1, + "childtable_count": 2, "childtable_prefix": "stb00_", "auto_create_table": "no", "batch_create_tbl_num": 10, "data_source": "rand", "insert_mode": "taosc", - "insert_rows": 1, + "insert_rows": 10, "childtable_limit": 0, "childtable_offset": 0, "interlace_rows": 0, "insert_interval": 0, "max_sql_len": 1024000, "disorder_ratio": 0, - "disorder_range": 0, + "disorder_range": 1000, "timestamp_step": 1000, "start_timestamp": "2021-02-25 10:00:00.000", "sample_format": "csv", "sample_file": "./sample.csv", "tags_file": "", - "columns": [{"type": "BINARY", "len":50, "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] }] }] diff --git a/tests/pytest/tools/taosdemoAllTest/subInsertdataMaxsql100.json b/tests/pytest/tools/taosdemoAllTest/subInsertdataMaxsql100.json new file mode 100644 index 0000000000..d5d0578f07 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subInsertdataMaxsql100.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 200, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1000, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-02-25 10:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 1000, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2021-02-25 10:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSync.json b/tests/pytest/tools/taosdemoAllTest/subSync.json new file mode 100644 index 0000000000..aa0b2cd7a4 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSync.json @@ -0,0 +1,45 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select ts from stb00_1", + "result": "./subscribe_res1.txt" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":10000, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }, + { + "sql": "select * from xxxx where ts > '2021-02-25 10:00:04.000' ", + "result": "./subscribe_res3.txt" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSyncResFileNull.json b/tests/pytest/tools/taosdemoAllTest/subSyncResFileNull.json new file mode 100644 index 0000000000..625e4792cf --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSyncResFileNull.json @@ -0,0 +1,49 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":2, + "mode":"sync", + "interval":0, + "restart":"no", + "keepProgress":"no", + "resubAfterConsume":-1, + "endAfterConsume":1, + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "" + }, + { + "sql": "select ts from stb00_1", + "result": "" + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":10000, + "restart":"no", + "keepProgress":"no", + "resubAfterConsume":-1, + "endAfterConsume":1, + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "" + }, + { + "sql": "select * from xxxx where ts > '2021-02-25 10:00:04.000' ", + "result": "" + }] + } + } \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100.json b/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100.json new file mode 100644 index 0000000000..6b2828822e --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100.json @@ -0,0 +1,439 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":1, + "mode":"sync", + "interval":0, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res1.txt" + }, + { + "sql": "select * from stb00_1", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_2", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_3", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_4", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_5", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_6", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_7", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_8", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_9", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_10 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_11 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_12 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_13 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_14 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_15 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_16 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_17 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_18 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_19 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_20 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_21 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_22 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_23 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_24 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_25 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_26 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_27 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_28 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_29 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_30 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_31 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_32 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_33 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_34 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_35 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_36 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_37 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_38 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_39 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_40 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_41 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_42 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_43 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_44 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_45 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_46 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_47 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_48 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_49 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_50 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_51 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_52 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_53 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_54 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_55 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_56 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_57 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_58 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_59 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_60", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_61", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_62", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_63", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_64", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_65", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_66", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_67", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_68", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_69", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_70 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_71 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_72 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_73 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_74 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_75 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_76 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_77 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_78 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_79 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_80 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_81 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_82 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_83 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_84 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_85 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_86 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_87 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_88 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_89 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_90 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_91 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_92 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_93 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_94 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_95 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_96 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_97 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_98 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_99 ", + "result": "./subscribe_res0.txt" + + }, + { + "sql": "select * from stb00_99 ", + "result": "./subscribe_res0.txt" + + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":0, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100Async.json b/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100Async.json new file mode 100644 index 0000000000..c45a9ea48a --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSyncSpecMaxsql100Async.json @@ -0,0 +1,439 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":1, + "mode":"async", + "interval":0, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from stb00_0", + "result": "./subscribe_res1.txt" + }, + { + "sql": "select * from stb00_1", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_2", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_3", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_4", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_5", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_6", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_7", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_8", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_9", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_10 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_11 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_12 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_13 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_14 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_15 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_16 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_17 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_18 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_19 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_20 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_21 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_22 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_23 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_24 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_25 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_26 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_27 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_28 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_29 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_30 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_31 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_32 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_33 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_34 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_35 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_36 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_37 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_38 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_39 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_40 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_41 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_42 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_43 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_44 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_45 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_46 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_47 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_48 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_49 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_50 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_51 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_52 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_53 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_54 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_55 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_56 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_57 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_58 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_59 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_60", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_61", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_62", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_63", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_64", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_65", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_66", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_67", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_68", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_69", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_70 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_71 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_72 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_73 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_74 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_75 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_76 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_77 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_78 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_79 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_80 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_81 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_82 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_83 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_84 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_85 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_86 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_87 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_88 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_89 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_90 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_91 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_92 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_93 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_94 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_95 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_96 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_97 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_98 ", + "result": "./subscribe_res0.txt" + }, + { + "sql": "select * from stb00_99 ", + "result": "./subscribe_res0.txt" + + }, + { + "sql": "select * from stb00_99 ", + "result": "./subscribe_res0.txt" + + }] + }, + "super_table_query": + { + "stblname": "stb0", + "threads":2, + "mode":"sync", + "interval":0, + "restart":"no", + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:01.000' ", + "result": "./subscribe_res2.txt" + }] + } +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100.json b/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100.json new file mode 100644 index 0000000000..3214d35bf0 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100.json @@ -0,0 +1,426 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "super_table_query": + { + "stblname": "stb1", + "threads":4, + "mode":"sync", + "interval":0, + "restart":"no", + "resubAfterConsume":-1, + "endAfterConsume":1, + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res2.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }] + } +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100Async.json b/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100Async.json new file mode 100644 index 0000000000..075ec9cf5d --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subSyncSuperMaxsql100Async.json @@ -0,0 +1,426 @@ +{ + "filetype":"subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "super_table_query": + { + "stblname": "stb1", + "threads":4, + "mode":"async", + "interval":0, + "restart":"no", + "resubAfterConsume":-1, + "endAfterConsume":1, + "keepProgress":"no", + "sqls": [ + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res2.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }, + { + "sql": "select * from xxxx where ts >= '2021-02-25 10:00:00.000' ", + "result": "./subscribe_res3.txt" + }] + } +} \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/sub_no_result.json b/tests/pytest/tools/taosdemoAllTest/sub_no_result.json new file mode 100644 index 0000000000..cdf7c2314e --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/sub_no_result.json @@ -0,0 +1,25 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": + { + "concurrent":1, + "mode":"sync", + "interval": 0, + "restart":"yes", + "keepProgress":"no", + "endAfterConsume": 1100000, + "sqls": [ + { + "sql": "select * from st;", + "result": "" + }] + } + } + \ No newline at end of file diff --git a/tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py b/tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py new file mode 100644 index 0000000000..270eea17cb --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py @@ -0,0 +1,82 @@ +################################################################### +# 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 os +import time +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import _thread + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1601481600000 + self.numberOfRecords = 1100000 + + def execCmdAndGetOutput(self, cmd): + r = os.popen(cmd) + text = r.read() + r.close() + return text + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + tdSql.prepare() + tdSql.execute("create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)") + tdSql.execute("create table t1 using st tags(0)") + currts = self.ts + finish = 0 + while(finish < self.numberOfRecords): + sql = "insert into t1 values" + for i in range(finish, self.numberOfRecords): + sql += "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" % (currts + i) + finish = i + 1 + if (1048576 - len(sql)) < 16384: + break + tdSql.execute(sql) + + binPath = buildPath+ "/build/bin/" + + os.system("%staosdemo -f tools/taosdemoAllTest/sub_no_result.json -g 2>&1 | tee sub_no_result.log" % binPath) + test_line = int(self.execCmdAndGetOutput("cat sub_no_result.log | wc -l")) + if(test_line < 1100024): + tdLog.exit("failed test subscribeNoResult: %d != expected(1100024)" % test_line) + + 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/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 5ecc4d70b2..01e46eaaa0 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -64,6 +64,22 @@ class TDTestCase: tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 200000) + # restful connector insert data + os.system("%staosdemo -f tools/taosdemoAllTest/insertRestful.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from stb00_0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count(*) from stb01_1") + tdSql.checkData(0, 0, 20) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 200) + # insert: create mutiple tables per sql and insert one rows per sql . os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath) @@ -165,6 +181,10 @@ class TDTestCase: tdSql.query("select count(*) from db.stb0") tdSql.checkData(0, 0, 10000) tdSql.execute("drop database if exists db") + os.system("%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath) + tdSql.query("select count(*) from db.stb0") + tdSql.checkRows(0) + tdSql.execute("drop database if exists db") os.system("%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath) tdSql.execute("use db") tdSql.query("show stables like 'stb0%' ") @@ -201,6 +221,12 @@ class TDTestCase: tdSql.checkData(0, 0, "2019-10-01 00:00:00") tdSql.query("select last(ts) from blf.p_0_topics_6 ") tdSql.checkData(0, 0, "2020-09-29 23:59:00") + os.system("%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 5000000) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 5000000) @@ -238,10 +264,12 @@ class TDTestCase: tdSql.execute("use dbtest123") tdSql.query("select col2 from stb0") tdSql.checkData(0, 0, 2147483647) - tdSql.query("select t1 from stb1") - tdSql.checkData(0, 0, -127) - tdSql.query("select t2 from stb1") - tdSql.checkData(1, 0, 126) + tdSql.query("select * from stb1 where t1=-127") + tdSql.checkRows(20) + tdSql.query("select * from stb1 where t2=127") + tdSql.checkRows(10) + tdSql.query("select * from stb1 where t2=126") + tdSql.checkRows(10) # insert: test interlace parament os.system("%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath) @@ -252,6 +280,42 @@ class TDTestCase: tdSql.checkData(0, 0, 15000) + # # insert: auto_create + + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(0) + tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(0) + tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(0) + + tdSql.execute('drop database if exists db') + os.system("%staosdemo -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies + tdSql.execute('use db') + tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(20) + os.system("rm -rf ./insert_res.txt") os.system("rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py index 643cad942c..6021c9136a 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py @@ -19,6 +19,9 @@ from util.sql import * from util.dnodes import * import time from datetime import datetime +import ast +# from assertpy import assert_that +import subprocess class TDTestCase: def init(self, conn, logSql): @@ -40,85 +43,145 @@ class TDTestCase: buildPath = root[:len(root)-len("/build/bin")] break return buildPath - + + # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 + def assertfileDataTaosc(self,filename,expectResult): + self.filename = filename + self.expectResult = expectResult + with open("%s" % filename, 'r+') as f1: + for line in f1.readlines(): + queryResult = line.strip().split()[0] + self.assertCheck(filename,queryResult,expectResult) + + # 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。 + def getfileDataRestful(self,filename): + self.filename = filename + with open("%s" % filename, 'r+') as f1: + for line in f1.readlines(): + contents = line.strip() + if contents.find("data") != -1: + contentsDict = ast.literal_eval(contents) # 字符串转换为字典 + queryResult = contentsDict['data'][0][0] + break + return queryResult + + # 获取taosc接口查询次数 + def queryTimesTaosc(self,filename): + self.filename = filename + command = 'cat %s |wc -l'% filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 获取restful接口查询次数 + def queryTimesRestful(self,filename): + self.filename = filename + command = 'cat %s |grep "200 OK" |wc -l'% filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 定义断言结果是否正确。不正确返回错误结果,正确即通过。 + def assertCheck(self,filename,queryResult,expectResult): + self.filename = filename + self.queryResult = queryResult + self.expectResult = expectResult + args0 = (filename, queryResult, expectResult) + assert queryResult == expectResult , "Queryfile:%s ,result is %s != expect: %s" % args0 + def run(self): buildPath = self.getBuildPath() if (buildPath == ""): tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - binPath = buildPath+ "/build/bin/" + binPath = buildPath+ "/build/bin/" + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") - # query: query specified table and query super table - os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryInsertdata.json" % binPath) - os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryTaosc.json" % binPath) - os.system("cat query_res0.txt* |sort -u > all_query_res0.txt") - os.system("cat query_res1.txt* |sort -u > all_query_res1.txt") - os.system("cat query_res2.txt* |sort -u > all_query_res2.txt") - tdSql.execute("use db") - tdSql.execute('create table result0 using stb0 tags(121,43,"beijing","beijing","beijing","beijing","beijing")') - os.system("python3 tools/taosdemoAllTest/convertResFile.py") - tdSql.execute("insert into result0 file './test_query_res0.txt'") - tdSql.query("select ts from result0") - tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000") - tdSql.query("select count(*) from result0") - tdSql.checkData(0, 0, 1) - with open('./all_query_res1.txt','r+') as f1: - result1 = int(f1.readline()) - tdSql.query("select count(*) from stb00_1") - tdSql.checkData(0, 0, "%d" % result1) - - with open('./all_query_res2.txt','r+') as f2: - result2 = int(f2.readline()) - d2 = datetime.fromtimestamp(result2/1000) - timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f") - tdSql.query("select last_row(ts) from stb1") - tdSql.checkData(0, 0, "%s" % timest) + # taosc query: query specified table and query super table + os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath) + os.system("%staosdemo -f tools/taosdemoAllTest/queryTaosc.json" % binPath) + os.system("cat query_res0.txt* > all_query_res0_taosc.txt") + os.system("cat query_res1.txt* > all_query_res1_taosc.txt") + os.system("cat query_res2.txt* > all_query_res2_taosc.txt") - # # delete useless files - # os.system("rm -rf ./insert_res.txt") - # os.system("rm -rf tools/taosdemoAllTest/*.py.sql") - # os.system("rm -rf ./querySystemInfo*") - # os.system("rm -rf ./query_res*") - # os.system("rm -rf ./all_query*") - # os.system("rm -rf ./test_query_res0.txt") + # correct Times testcases + queryTimes0Taosc = self.queryTimesTaosc("all_query_res0_taosc.txt") + self.assertCheck("all_query_res0_taosc.txt",queryTimes0Taosc,6) + queryTimes1Taosc = self.queryTimesTaosc("all_query_res1_taosc.txt") + self.assertCheck("all_query_res1_taosc.txt",queryTimes1Taosc,6) - # # use restful api to query - # os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryInsertdata.json" % binPath) - # os.system("%staosdemo -f tools/taosdemoAllTest/speciQueryRestful.json" % binPath) - # os.system("cat query_res0.txt* |sort -u > all_query_res0.txt") - # os.system("cat query_res1.txt* |sort -u > all_query_res1.txt") - # # os.system("cat query_res2.txt* |sort -u > all_query_res2.txt") - # tdSql.execute("use db") - # tdSql.execute('create table result0 using stb0 tags(121,43,"beijing","beijing","beijing","beijing","beijing")') - # os.system("python3 tools/taosdemoAllTest/convertResFile.py") - # tdSql.execute("insert into result0 file './test_query_res0.txt'") - # tdSql.query("select ts from result0") - # tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000") - # tdSql.query("select count(*) from result0") - # tdSql.checkData(0, 0, 1) - # with open('./all_query_res1.txt','r+') as f1: - # result1 = int(f1.readline()) - # tdSql.query("select count(*) from stb00_1") - # tdSql.checkData(0, 0, "%d" % result1) - - # with open('./all_query_res2.txt','r+') as f2: - # result2 = int(f2.readline()) - # d2 = datetime.fromtimestamp(result2/1000) - # timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f") - # tdSql.query("select last_row(ts) from stb1") - # tdSql.checkData(0, 0, "%s" % timest) + queryTimes2Taosc = self.queryTimesTaosc("all_query_res2_taosc.txt") + self.assertCheck("all_query_res2_taosc.txt",queryTimes2Taosc,20) + # correct data testcase + self.assertfileDataTaosc("all_query_res0_taosc.txt","1604160000099") + self.assertfileDataTaosc("all_query_res1_taosc.txt","100") + self.assertfileDataTaosc("all_query_res2_taosc.txt","1604160000199") + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # use restful api to query + os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertrestdata.json" % binPath) + os.system("%staosdemo -f tools/taosdemoAllTest/queryRestful.json" % binPath) + os.system("cat query_res0.txt* > all_query_res0_rest.txt") + os.system("cat query_res1.txt* > all_query_res1_rest.txt") + os.system("cat query_res2.txt* > all_query_res2_rest.txt") + + # correct Times testcases + queryTimes0Restful = self.queryTimesRestful("all_query_res0_rest.txt") + self.assertCheck("all_query_res0_rest.txt",queryTimes0Restful,6) + + queryTimes1Restful = self.queryTimesRestful("all_query_res1_rest.txt") + self.assertCheck("all_query_res1_rest.txt",queryTimes1Restful,6) + + queryTimes2Restful = self.queryTimesRestful("all_query_res2_rest.txt") + self.assertCheck("all_query_res2_rest.txt",queryTimes2Restful,4) + + # correct data testcase + data0 = self.getfileDataRestful("all_query_res0_rest.txt") + self.assertCheck('all_query_res0_rest.txt',data0,"2020-11-01 00:00:00.009") + + data1 = self.getfileDataRestful("all_query_res1_rest.txt") + self.assertCheck('all_query_res1_rest.txt',data1,10) + + data2 = self.getfileDataRestful("all_query_res2_rest.txt") + self.assertCheck('all_query_res2_rest.txt',data2,"2020-11-01 00:00:00.004") + # query times less than or equal to 100 + os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath) os.system("%staosdemo -f tools/taosdemoAllTest/querySpeciMutisql100.json" % binPath) os.system("%staosdemo -f tools/taosdemoAllTest/querySuperMutisql100.json" % binPath) - # query result print QPS + #query result print QPS + os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath) os.system("%staosdemo -f tools/taosdemoAllTest/queryQps.json" % binPath) + + # use illegal or out of range parameters query json file + os.system("%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" % binPath) + exceptcode = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimes0.json" % binPath) + assert exceptcode != 0 + exceptcode0 = os.system("%staosdemo -f tools/taosdemoAllTest/queryTimesless0.json" % binPath) + assert exceptcode0 != 0 + + exceptcode1 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrentless0.json" % binPath) + assert exceptcode1 != 0 + + exceptcode2 = os.system("%staosdemo -f tools/taosdemoAllTest/queryConcurrent0.json" % binPath) + assert exceptcode2 != 0 + + exceptcode3 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreadsless0.json" % binPath) + assert exceptcode3 != 0 + + exceptcode4 = os.system("%staosdemo -f tools/taosdemoAllTest/querrThreads0.json" % binPath) + assert exceptcode4 != 0 # delete useless files os.system("rm -rf ./insert_res.txt") @@ -127,6 +190,8 @@ class TDTestCase: os.system("rm -rf ./query_res*") os.system("rm -rf ./all_query*") os.system("rm -rf ./test_query_res0.txt") + + def stop(self): tdSql.close() diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJson.py index 1275b6a8b5..3e967581a4 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJson.py @@ -19,6 +19,8 @@ from util.sql import * from util.dnodes import * import time from datetime import datetime +import subprocess + class TDTestCase: def init(self, conn, logSql): @@ -40,7 +42,22 @@ class TDTestCase: buildPath = root[:len(root)-len("/build/bin")] break return buildPath - + + # get the number of subscriptions + def subTimes(self,filename): + self.filename = filename + command = 'cat %s |wc -l'% filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # assert results + def assertCheck(self,filename,subResult,expectResult): + self.filename = filename + self.subResult = subResult + self.expectResult = expectResult + args0 = (filename, subResult, expectResult) + assert subResult == expectResult , "Queryfile:%s ,result is %s != expect: %s" % args0 + def run(self): buildPath = self.getBuildPath() if (buildPath == ""): @@ -48,48 +65,136 @@ class TDTestCase: else: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - - # query: query specified table and query super table - # os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdata.json" % binPath) - # os.system("%staosdemo -f tools/taosdemoAllTest/sub.json" % binPath) - # os.system("cat query_res0.txt* |sort -u > all_query_res0.txt") - # os.system("cat query_res1.txt* |sort -u > all_query_res1.txt") - # os.system("cat query_res2.txt* |sort -u > all_query_res2.txt") - # tdSql.execute("use db") - # tdSql.execute('create table result0 using stb0 tags(121,43,"beijing","beijing","beijing","beijing","beijing")') - # os.system("python3 tools/taosdemoAllTest/convertResFile.py") - # tdSql.execute("insert into result0 file './test_query_res0.txt'") - # tdSql.query("select ts from result0") - # tdSql.checkData(0, 0, "2020-11-01 00:00:00.099000") - # tdSql.query("select count(*) from result0") - # tdSql.checkData(0, 0, 1) - # with open('./all_query_res1.txt','r+') as f1: - # result1 = int(f1.readline()) - # tdSql.query("select count(*) from stb00_1") - # tdSql.checkData(0, 0, "%d" % result1) - # with open('./all_query_res2.txt','r+') as f2: - # result2 = int(f2.readline()) - # d2 = datetime.fromtimestamp(result2/1000) - # timest = d2.strftime("%Y-%m-%d %H:%M:%S.%f") - # tdSql.query("select last_row(ts) from stb1") - # tdSql.checkData(0, 0, "%s" % timest) + # clear env + os.system("ps -ef |grep 'taosdemoAllTest/subSync.json' |grep -v 'grep' |awk '{print $2}'|xargs kill -9") + os.system("ps -ef |grep 'taosdemoAllTest/subSyncKeepStart.json' |grep -v 'grep' |awk '{print $2}'|xargs kill -9") + sleep(1) + os.system("rm -rf ./subscribe_res*") + os.system("rm -rf ./all_subscribe_res*") + sleep(2) + # subscribe: sync + os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdata.json" % binPath) + os.system("nohup %staosdemo -f tools/taosdemoAllTest/subSync.json &" % binPath) + query_pid = int(subprocess.getstatusoutput('ps aux|grep "taosdemoAllTest/subSync.json" |grep -v "grep"|awk \'{print $2}\'')[1]) + + # insert extral data + tdSql.execute("use db") + tdSql.execute("insert into stb00_0 values(1614218412000,'R','bf3',8637,98.861045)") + tdSql.execute("insert into stb00_1 values(1614218412000,'R','bf3',8637,78.861045)(1614218422000,'R','bf3',8637,98.861045)") + sleep(5) + + # merge result files + os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt") + os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt") + os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt") + os.system("cat subscribe_res3.txt* > all_subscribe_res3.txt") - # # query times less than or equal to 100 - # os.system("%staosdemo -f tools/taosdemoAllTest/QuerySpeciMutisql100.json" % binPath) - # os.system("%staosdemo -f tools/taosdemoAllTest/QuerySuperMutisql100.json" % binPath) + # correct subscribeTimes testcase + subTimes0 = self.subTimes("all_subscribe_res0.txt") + self.assertCheck("all_subscribe_res0.txt",subTimes0 ,22) + + subTimes1 = self.subTimes("all_subscribe_res1.txt") + self.assertCheck("all_subscribe_res1.txt",subTimes1 ,24) + + subTimes2 = self.subTimes("all_subscribe_res2.txt") + self.assertCheck("all_subscribe_res2.txt",subTimes2 ,21) + + subTimes3 = self.subTimes("all_subscribe_res3.txt") + self.assertCheck("all_subscribe_res3.txt",subTimes3 ,13) + + + # correct data testcase + os.system("kill -9 %d" % query_pid) + sleep(3) + os.system("rm -rf ./subscribe_res*") + os.system("rm -rf ./all_subscribe*") + + # # sql number lager 100 + os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdataMaxsql100.json" % binPath) + assert os.system("%staosdemo -f tools/taosdemoAllTest/subSyncSpecMaxsql100.json" % binPath) != 0 + assert os.system("%staosdemo -f tools/taosdemoAllTest/subSyncSuperMaxsql100.json" % binPath) != 0 + + # # result files is null + # os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdataMaxsql100.json" % binPath) + # os.system("%staosdemo -f tools/taosdemoAllTest/subSyncResFileNull.json" % binPath) + # # assert os.system("%staosdemo -f tools/taosdemoAllTest/subSyncResFileNull.json" % binPath) != 0 + + + + + # resubAfterConsume= -1 endAfter=-1 ; + os.system('kill -9 `ps aux|grep "subSyncResubACMinus1.json" |grep -v "grep"|awk \'{print $2}\'` ') + os.system("nohup %staosdemo -f tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1.json & " % binPath) + sleep(2) + query_pid1 = int(subprocess.getstatusoutput('ps aux|grep "subSyncResubACMinus1.json" |grep -v "grep"|awk \'{print $2}\'')[1]) + print("get sub1 process'pid") + subres0Number1 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + subres2Number1 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res2* |wc -l' )[1]) + assert 0==subres0Number1 , "subres0Number1 error" + assert 0==subres2Number1 , "subres2Number1 error" + tdSql.execute("insert into db.stb00_0 values(1614218412000,'R','bf3',8637,78.861045)(1614218413000,'R','bf3',8637,98.861045)") + sleep(4) + subres2Number2 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + subres0Number2 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + assert 0!=subres2Number2 , "subres2Number2 error" + assert 0!=subres0Number2 , "subres0Number2 error" + os.system("kill -9 %d" % query_pid1) + os.system("rm -rf ./subscribe_res*") + + # # resubAfterConsume= -1 endAfter=0 ; + # os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdataMaxsql100.json" % binPath) + # os.system('kill -9 `ps aux|grep "subSyncResubACMinus1endAfter0.json" |grep -v "grep"|awk \'{print $2}\'` ') + # os.system("nohup %staosdemo -f tools/taosdemoAllTest/Resubjson/subSyncResubACMinus1endAfter0.json & " % binPath) + # sleep(2) + # query_pid1 = int(subprocess.getstatusoutput('ps aux|grep "subSyncResubACMinus1endAfter0.json" |grep -v "grep"|awk \'{print $2}\'')[1]) + # print("get sub2 process'pid") + # subres0Number1 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + # subres2Number1 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res2* |wc -l' )[1]) + # assert 0==subres0Number1 , "subres0Number1 error" + # assert 0==subres2Number1 , "subres2Number1 error" + # tdSql.execute("insert into db.stb00_0 values(1614218412000,'R','bf3',8637,78.861045)(1614218413000,'R','bf3',8637,98.861045)") + # sleep(4) + # subres2Number2 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + # subres0Number2 =int(subprocess.getstatusoutput('grep "1614218412000" subscribe_res0* |wc -l' )[1]) + # assert 0!=subres2Number2 , "subres2Number2 error" + # assert 0!=subres0Number2 , "subres0Number2 error" + # os.system("kill -9 %d" % query_pid1) + # os.system("rm -rf ./subscribe_res*") + # # # merge result files + # os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt") + # os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt") + # os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt") + # # os.system("cat subscribe_res3.txt* > all_subscribe_res3.txt") + + # sleep(3) + + # # correct subscribeTimes testcase + # subTimes0 = self.subTimes("all_subscribe_res0.txt") + # self.assertCheck("all_subscribe_res0.txt",subTimes0 ,3960) + + # subTimes1 = self.subTimes("all_subscribe_res1.txt") + # self.assertCheck("all_subscribe_res1.txt",subTimes1 ,40) + + # subTimes2 = self.subTimes("all_subscribe_res2.txt") + # self.assertCheck("all_subscribe_res2.txt",subTimes2 ,1900) + + + # os.system("%staosdemo -f tools/taosdemoAllTest/subSupermaxsql100.json" % binPath) + # os.system("%staosdemo -f tools/taosdemoAllTest/subSupermaxsql100.json" % binPath) + + + # delete useless files - # os.system("rm -rf ./insert_res.txt") - # os.system("rm -rf tools/taosdemoAllTest/*.py.sql") - # os.system("rm -rf ./querySystemInfo*") - # os.system("rm -rf ./query_res*") - # os.system("rm -rf ./all_query*") - # os.system("rm -rf ./test_query_res0.txt") + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf tools/taosdemoAllTest/*.py.sql") + os.system("rm -rf ./subscribe_res*") + os.system("rm -rf ./all_subscribe*") def stop(self): tdSql.close() diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py new file mode 100644 index 0000000000..f2aa01e870 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py @@ -0,0 +1,124 @@ +################################################################### +# 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 os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import time +from datetime import datetime +import subprocess + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # 获取订阅次数 + def subTimes(self,filename): + self.filename = filename + command = 'cat %s |wc -l'% filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + def assertCheck(self,filename,queryResult,expectResult): + self.filename = filename + self.queryResult = queryResult + self.expectResult = expectResult + args0 = (filename, queryResult, expectResult) + assert queryResult == expectResult , "Queryfile:%s ,result is %s != expect: %s" % args0 + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + + # clear env + os.system("ps -ef |grep 'taosdemoAllTest/subAsync.json' |grep -v 'grep' |awk '{print $2}'|xargs kill -9") + sleep(1) + os.system("rm -rf ./subscribe_res*") + os.system("rm -rf ./all_subscribe_res*") + + # subscribe: resultfile + os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdata.json" % binPath) + os.system("nohup %staosdemo -f tools/taosdemoAllTest/subAsync.json &" % binPath) + query_pid = int(subprocess.getstatusoutput('ps aux|grep "taosdemoAllTest/subAsync.json" |grep -v "grep"|awk \'{print $2}\'')[1]) + + # insert extral data + tdSql.execute("use db") + tdSql.execute("insert into stb00_0 values(1614218412000,'R','bf3',8637,98.861045)") + tdSql.execute("insert into stb00_1 values(1614218412000,'R','bf3',8637,78.861045)(1614218422000,'R','bf3',8637,98.861045)") + sleep(5) + + # merge result files + os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt") + os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt") + os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt") + os.system("cat subscribe_res3.txt* > all_subscribe_res3.txt") + + # correct subscribeTimes testcase + subTimes0 = self.subTimes("all_subscribe_res0.txt") + self.assertCheck("all_subscribe_res0.txt",subTimes0 ,22) + + subTimes1 = self.subTimes("all_subscribe_res1.txt") + self.assertCheck("all_subscribe_res1.txt",subTimes1 ,24) + + subTimes2 = self.subTimes("all_subscribe_res2.txt") + self.assertCheck("all_subscribe_res2.txt",subTimes2 ,21) + + subTimes3 = self.subTimes("all_subscribe_res3.txt") + self.assertCheck("all_subscribe_res3.txt",subTimes3 ,13) + + # correct data testcase + + os.system("kill -9 %d" % query_pid) + + # # query times less than or equal to 100 + os.system("%staosdemo -f tools/taosdemoAllTest/subInsertdataMaxsql100.json" % binPath) + assert os.system("%staosdemo -f tools/taosdemoAllTest/subSyncSpecMaxsql100.json" % binPath) != 0 + assert os.system("%staosdemo -f tools/taosdemoAllTest/subSyncSuperMaxsql100.json" % binPath) != 0 + + # delete useless files + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf tools/taosdemoAllTest/*.py.sql") + os.system("rm -rf ./subscribe_res*") + os.system("rm -rf ./all_subscribe*") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdemoPerformance.py b/tests/pytest/tools/taosdemoPerformance.py index a45393e222..c4b125969a 100644 --- a/tests/pytest/tools/taosdemoPerformance.py +++ b/tests/pytest/tools/taosdemoPerformance.py @@ -17,10 +17,11 @@ import argparse import os.path import json + class taosdemoPerformace: def __init__(self, commitID, dbName): self.commitID = commitID - self.dbName = dbName + self.dbName = dbName self.host = "127.0.0.1" self.user = "root" self.password = "taosdata" @@ -30,8 +31,8 @@ class taosdemoPerformace: self.user, self.password, self.config) - self.insertDB = "insertDB"; - + self.insertDB = "insertDB" + def generateJson(self): db = { "name": "%s" % self.insertDB, @@ -41,7 +42,7 @@ class taosdemoPerformace: stb = { "name": "meters", - "child_table_exists":"no", + "child_table_exists": "no", "childtable_count": 10000, "childtable_prefix": "stb_", "auto_create_table": "no", @@ -57,12 +58,12 @@ class taosdemoPerformace: "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", "sample_file": "./sample.csv", - "tags_file": "", + "tags_file": "", "columns": [ {"type": "INT", "count": 4} - ], + ], "tags": [ - {"type": "INT", "count":1}, + {"type": "INT", "count": 1}, {"type": "BINARY", "len": 16} ] } @@ -88,7 +89,7 @@ class taosdemoPerformace: "confirm_parameter_prompt": "no", "insert_interval": 0, "num_of_records_per_req": 30000, - "databases": [db] + "databases": [db] } insert_json_file = f"/tmp/insert.json" @@ -103,24 +104,56 @@ class taosdemoPerformace: cmd.close() return output - def insertData(self): - os.system("taosdemo -f %s > taosdemoperf.txt 2>&1" % self.generateJson()) - self.createTableTime = self.getCMDOutput("grep 'Spent' taosdemoperf.txt | awk 'NR==1{print $2}'") - self.insertRecordsTime = self.getCMDOutput("grep 'Spent' taosdemoperf.txt | awk 'NR==2{print $2}'") - self.recordsPerSecond = self.getCMDOutput("grep 'Spent' taosdemoperf.txt | awk 'NR==2{print $16}'") + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosdemo" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def insertData(self): + tdSql.prepare() + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosdemo not found!") + else: + tdLog.info("taosdemo found in %s" % buildPath) + binPath = buildPath + "/build/bin/" + + os.system( + "%staosdemo -f %s > taosdemoperf.txt 2>&1" % + (binPath, self.generateJson())) + self.createTableTime = self.getCMDOutput( + "grep 'Spent' taosdemoperf.txt | awk 'NR==1{print $2}'") + self.insertRecordsTime = self.getCMDOutput( + "grep 'Spent' taosdemoperf.txt | awk 'NR==2{print $2}'") + self.recordsPerSecond = self.getCMDOutput( + "grep 'Spent' taosdemoperf.txt | awk 'NR==2{print $16}'") self.commitID = self.getCMDOutput("git rev-parse --short HEAD") - delay = self.getCMDOutput("grep 'delay' taosdemoperf.txt | awk '{print $4}'") + delay = self.getCMDOutput( + "grep 'delay' taosdemoperf.txt | awk '{print $4}'") self.avgDelay = delay[:-4] - delay = self.getCMDOutput("grep 'delay' taosdemoperf.txt | awk '{print $6}'") + delay = self.getCMDOutput( + "grep 'delay' taosdemoperf.txt | awk '{print $6}'") self.maxDelay = delay[:-4] - delay = self.getCMDOutput("grep 'delay' taosdemoperf.txt | awk '{print $8}'") + delay = self.getCMDOutput( + "grep 'delay' taosdemoperf.txt | awk '{print $8}'") self.minDelay = delay[:-3] os.system("[ -f taosdemoperf.txt ] && rm taosdemoperf.txt") def createTablesAndStoreData(self): cursor = self.conn.cursor() - + cursor.execute("create database if not exists %s" % self.dbName) cursor.execute("use %s" % self.dbName) cursor.execute("create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float)") @@ -130,13 +163,21 @@ class taosdemoPerformace: print("records per second: %f" % float(self.recordsPerSecond)) print("avg delay: %f" % float(self.avgDelay)) print("max delay: %f" % float(self.maxDelay)) - print("min delay: %f" % float(self.minDelay)) - cursor.execute("insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f)" % - (float(self.createTableTime), float(self.insertRecordsTime), float(self.recordsPerSecond), self.commitID, float(self.avgDelay), float(self.maxDelay), float(self.minDelay))) + print("min delay: %f" % float(self.minDelay)) + cursor.execute( + "insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f)" % + (float( + self.createTableTime), float( + self.insertRecordsTime), float( + self.recordsPerSecond), self.commitID, float( + self.avgDelay), float( + self.maxDelay), float( + self.minDelay))) cursor.execute("drop database if exists %s" % self.insertDB) cursor.close() + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( @@ -155,6 +196,6 @@ if __name__ == '__main__': args = parser.parse_args() - perftest = taosdemoPerformace(args.commit_id, args.database_name) + perftest = taosdemoPerformace(args.commit_id, args.database_name) perftest.insertData() perftest.createTablesAndStoreData() diff --git a/tests/pytest/tools/taosdemoTest.py b/tests/pytest/tools/taosdemoTest.py index ff5921be60..fec69bed64 100644 --- a/tests/pytest/tools/taosdemoTest.py +++ b/tests/pytest/tools/taosdemoTest.py @@ -36,7 +36,7 @@ class TDTestCase: projPath = selfPath[:selfPath.find("tests")] for root, dirs, files in os.walk(projPath): - if ("taosd" in files): + if ("taosdemo" in files): rootRealPath = os.path.dirname(os.path.realpath(root)) if ("packaging" not in rootRealPath): buildPath = root[:len(root) - len("/build/bin")] @@ -47,9 +47,9 @@ class TDTestCase: tdSql.prepare() buildPath = self.getBuildPath() if (buildPath == ""): - tdLog.exit("taosd not found!") + tdLog.exit("taosdemo not found!") else: - tdLog.info("taosd found in %s" % buildPath) + tdLog.info("taosdemo found in %s" % buildPath) binPath = buildPath + "/build/bin/" os.system("%staosdemo -y -t %d -n %d" % (binPath, self.numberOfTables, self.numberOfRecords)) diff --git a/tests/pytest/tools/taosdumpTest.py b/tests/pytest/tools/taosdumpTest.py index 534a477b34..beac22a2af 100644 --- a/tests/pytest/tools/taosdumpTest.py +++ b/tests/pytest/tools/taosdumpTest.py @@ -23,42 +23,110 @@ class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - + self.ts = 1538548685000 self.numberOfTables = 10000 self.numberOfRecords = 100 - - def run(self): - tdSql.prepare() - tdSql.execute("create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") - tdSql.execute("create table t1 using st tags(1, 'beijing')") + def checkCommunity(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + return False + else: + return True + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosdump" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def run(self): + if not os.path.exists("./taosdumptest/tmp1"): + os.makedirs("./taosdumptest/tmp1") + else: + print("目录存在") + + if not os.path.exists("./taosdumptest/tmp2"): + os.makedirs("./taosdumptest/tmp2") + tdSql.execute("drop database if exists db") + tdSql.execute("create database db days 11 keep 3649 blocks 8 ") + tdSql.execute("create database db1 days 12 keep 3640 blocks 7 ") + tdSql.execute("use db") + + tdSql.execute( + "create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") + tdSql.execute("create table t1 using st tags(1, 'beijing')") sql = "insert into t1 values" currts = self.ts for i in range(100): sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) tdSql.execute(sql) - - tdSql.execute("create table t2 using st tags(2, 'shanghai')") + tdSql.execute("create table t2 using st tags(2, 'shanghai')") sql = "insert into t2 values" currts = self.ts for i in range(100): sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) tdSql.execute(sql) - os.system("taosdump --databases db -o /tmp") - + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % buildPath) + binPath = buildPath + "/build/bin/" + + os.system("rm ./taosdumptest/tmp1/*.sql") + os.system("%staosdump --databases db -o ./taosdumptest/tmp1" % binPath) + os.system("%staosdump --databases db1 -o ./taosdumptest/tmp2" % binPath) + tdSql.execute("drop database db") + tdSql.execute("drop database db1") tdSql.query("show databases") tdSql.checkRows(0) - - os.system("taosdump -i /tmp") - tdSql.query("show databases") - tdSql.checkRows(1) - tdSql.checkData(0, 0, 'db') - + os.system("%staosdump -i ./taosdumptest/tmp1" % binPath) + os.system("%staosdump -i ./taosdumptest/tmp2" % binPath) + tdSql.execute("use db") + tdSql.query("show databases") + tdSql.checkRows(2) + dbresult = tdSql.queryResult + # 6--days,7--keep0,keep1,keep, 12--block, + + isCommunity = self.checkCommunity() + + print("iscommunity: %d" % isCommunity) + for i in range(len(dbresult)): + if dbresult[i][0] == 'db': + print(dbresult[i]) + print(type(dbresult[i][6])) + print(type(dbresult[i][7])) + print(type(dbresult[i][9])) + assert dbresult[i][6] == 11 + if isCommunity: + assert dbresult[i][7] == "3649" + else: + assert dbresult[i][7] == "3649,3649,3649" + assert dbresult[i][9] == 8 + if dbresult[i][0] == 'db1': + assert dbresult[i][6] == 12 + if isCommunity: + assert dbresult[i][7] == "3640" + else: + assert dbresult[i][7] == "3640,3640,3640" + assert dbresult[i][9] == 7 + tdSql.query("show stables") tdSql.checkRows(1) tdSql.checkData(0, 0, 'st') @@ -80,10 +148,42 @@ class TDTestCase: tdSql.checkData(i, 1, i) tdSql.checkData(i, 2, "nchar%d" % i) + # drop all databases,boundary value testing. + # length(databasename)<=32;length(tablesname)<=192 + tdSql.execute("drop database db") + tdSql.execute("drop database db1") + os.system("rm -rf ./taosdumptest/tmp1") + os.system("rm -rf ./taosdumptest/tmp2") + os.makedirs("./taosdumptest/tmp1") + tdSql.execute("create database db12312313231231321312312312_323") + tdSql.error("create database db12312313231231321312312312_3231") + tdSql.execute("use db12312313231231321312312312_323") + tdSql.execute("create stable st12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") + tdSql.error("create stable st_12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") + tdSql.execute( + "create stable st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") + tdSql.error("create stable st1(ts timestamp, c1 int, col2_012345678901234567890123456789012345678901234567890123456789 nchar(10)) tags(t1 int, t2 binary(10))") + + tdSql.execute("select * from db12312313231231321312312312_323.st12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9") + tdSql.error("create table t0_12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9 using st tags(1, 'beijing')") + tdSql.query("show stables") + tdSql.checkRows(2) + os.system( + "%staosdump --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" % binPath) + tdSql.execute("drop database db12312313231231321312312312_323") + os.system("%staosdump -i ./taosdumptest/tmp1" % binPath) + tdSql.execute("use db12312313231231321312312312_323") + tdSql.query("show stables") + tdSql.checkRows(2) + os.system("rm -rf ./taosdumptest/tmp1") + os.system("rm -rf ./taosdumptest/tmp2") + os.system("rm -rf ./dump_result.txt") + os.system("rm -rf ./db.csv") + 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 +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/tools/taosdumpTest2.py b/tests/pytest/tools/taosdumpTest2.py new file mode 100644 index 0000000000..bed0564139 --- /dev/null +++ b/tests/pytest/tools/taosdumpTest2.py @@ -0,0 +1,99 @@ +################################################################### +# 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 os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1601481600000 + self.numberOfTables = 1 + self.numberOfRecords = 15000 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosdump" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def run(self): + tdSql.prepare() + + tdSql.execute("create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)") + tdSql.execute("create table t1 using st tags(0)") + currts = self.ts + finish = 0 + while(finish < self.numberOfRecords): + sql = "insert into t1 values" + for i in range(finish, self.numberOfRecords): + sql += "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" % (currts + i) + finish = i + 1 + if (1048576 - len(sql)) < 16384: + break + tdSql.execute(sql) + + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % buildPath) + binPath = buildPath + "/build/bin/" + + os.system("rm /tmp/*.sql") + os.system( + "%staosdump --databases db -o /tmp -B 32766 -L 1048576" % + binPath) + + tdSql.execute("drop database db") + tdSql.query("show databases") + tdSql.checkRows(0) + + os.system("%staosdump -i /tmp" % binPath) + + tdSql.query("show databases") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 'db') + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 'st') + + tdSql.query("select count(*) from t1") + tdSql.checkData(0, 0, self.numberOfRecords) + + 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/dnodes.py b/tests/pytest/util/dnodes.py index 6eaf4e18af..ae4ba97eb3 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -127,6 +127,7 @@ class TDDnode: "anyIp":"0", "tsEnableTelemetryReporting":"0", "dDebugFlag":"135", + "tsdbDebugFlag":"135", "mDebugFlag":"135", "sdbDebugFlag":"135", "rpcDebugFlag":"135", @@ -432,7 +433,7 @@ class TDDnodes: self.simDeployed = False def init(self, path): - psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") while(processID): killCmd = "kill -TERM %s > /dev/null 2>&1" % processID @@ -545,14 +546,14 @@ class TDDnodes: for i in range(len(self.dnodes)): self.dnodes[i].stop() - psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep | awk '{print $2}'" + psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") if processID: cmd = "sudo systemctl stop taosd" os.system(cmd) # if os.system(cmd) != 0 : # tdLog.exit(cmd) - psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8") while(processID): killCmd = "kill -TERM %s > /dev/null 2>&1" % processID diff --git a/tests/pytest/util/pathFinding.py b/tests/pytest/util/pathFinding.py new file mode 100644 index 0000000000..9dee5142ce --- /dev/null +++ b/tests/pytest/util/pathFinding.py @@ -0,0 +1,83 @@ +################################################################### +# 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 * + + + +class TDFindPath: + """This class is for finding path within TDengine + """ + def __init__(self): + self.file = "" + + + def init(self, file): + """[summary] + + Args: + file (str): the file location you want to start the query. Generally using __file__ + """ + self.file = file + + def getTaosdemoPath(self): + """for finding the path of directory containing taosdemo + + Returns: + str: the path to directory containing taosdemo + """ + selfPath = os.path.dirname(os.path.realpath(self.file)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info(f"taosd found in {buildPath}") + return buildPath + "/build/bin/" + + def getTDenginePath(self): + """for finding the root path of TDengine + + Returns: + str: the root path of TDengine + """ + selfPath = os.path.dirname(os.path.realpath(self.file)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + print(projPath) + for root, dirs, files in os.walk(projPath): + if ("sim" in dirs): + print(root) + rootRealPath = os.path.realpath(root) + if (rootRealPath == ""): + tdLog.exit("TDengine not found!") + else: + tdLog.info(f"TDengine found in {rootRealPath}") + return rootRealPath + +tdFindPath = TDFindPath() \ No newline at end of file diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 8f62c5932b..913c158d05 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -18,6 +18,7 @@ import datetime import inspect import psutil import shutil +import pandas as pd from util.log import * @@ -134,25 +135,32 @@ class TDSql: return self.cursor.istype(col, dataType) def checkData(self, row, col, data): - self.checkRowCol(row, col) - if self.queryResult[row][col] != data: - if self.cursor.istype(col, "TIMESTAMP") and self.queryResult[row][col] == datetime.datetime.fromisoformat(data): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + self.checkRowCol(row, col) + if self.queryResult[row][col] != data: + if self.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(self.queryResult[row][col]) == pd.to_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" % + (self.sql, row, col, self.queryResult[row][col], data)) + else: + if self.queryResult[row][col] == datetime.datetime.fromisoformat(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (self.sql, row, col, self.queryResult[row][col], data)) return if str(self.queryResult[row][col]) == str(data): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (self.sql, row, col, self.queryResult[row][col], data)) + (self.sql, row, col, self.queryResult[row][col], data)) return - elif isinstance(data, float) and abs(self.queryResult[row][col] - data) <= 0.000001: + elif 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)) + (self.sql, row, col, self.queryResult[row][col], data)) return else: caller = inspect.getframeinfo(inspect.stack()[1][0]) args = (caller.filename, caller.lineno, self.sql, row, col, self.queryResult[row][col], data) - tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) + tdLog.exit("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) if data is None: tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % @@ -162,11 +170,11 @@ class TDSql: (self.sql, row, col, self.queryResult[row][col], data)) elif isinstance(data, datetime.date): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (self.sql, row, col, self.queryResult[row][col], data)) + (self.sql, row, col, self.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (self.sql, row, col, self.queryResult[row][col], data)) - else: + else: tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" % (self.sql, row, col, self.queryResult[row][col], data)) @@ -200,7 +208,7 @@ class TDSql: tdLog.exit("%s(%d) failed: sql:%s, affectedRows:%d != expect:%d" % args) tdLog.info("sql:%s, affectedRows:%d == expect:%d" % (self.sql, self.affectedRows, expectAffectedRows)) - + def taosdStatus(self, state): tdLog.sleep(5) pstate = 0 @@ -221,7 +229,7 @@ class TDSql: continue pstate = 0 break - + args=(pstate,state) if pstate == state: tdLog.info("taosd state is %d == expect:%d" %args) @@ -236,11 +244,11 @@ class TDSql: tdLog.exit("dir: %s is empty, expect: not empty" %dir) else: tdLog.info("dir: %s is empty, expect: empty" %dir) - else: + else: if state : tdLog.info("dir: %s is not empty, expect: not empty" %dir) else: - tdLog.exit("dir: %s is not empty, expect: empty" %dir) + tdLog.exit("dir: %s is not empty, expect: empty" %dir) else: tdLog.exit("dir: %s doesn't exist" %dir) def createDir(self, dir): @@ -250,5 +258,5 @@ class TDSql: os.makedirs( dir, 755 ) tdLog.info("dir: %s is created" %dir) pass - + tdSql = TDSql() diff --git a/tests/pytest/util/taosdemoCfg.py b/tests/pytest/util/taosdemoCfg.py new file mode 100644 index 0000000000..d211f86b81 --- /dev/null +++ b/tests/pytest/util/taosdemoCfg.py @@ -0,0 +1,465 @@ +################################################################### +# 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 os +import time +import datetime +import inspect +import psutil +import shutil +import json +from util.log import * +from multiprocessing import cpu_count + + +# TODO: fully test the function. Handle exceptions. +# Handle json format not accepted by taosdemo + +### How to use TaosdemoCfg: +# Before you start: +# Make sure you understand how is taosdemo's JSON file structured. Because the python used does +# not support directory in directory for self objects, the config is being tear to different parts. +# Please make sure you understand which directory represent which part of which type of the file +# This module will reassemble the parts when creating the JSON file. +# +# Basic use example +# step 1:use self.append_sql_stb() to append the insert/query/subscribe directory into the module +# you can append many insert/query/subscribe directory, but pay attention about taosdemo's limit +# step 2:use alter function to alter the specific config +# step 3:use the generation function to generate the files +# +# step 1 and step 2 can be replaced with using import functions +class TDTaosdemoCfg: + def __init__(self): + self.insert_cfg = { + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": cpu_count(), + "thread_count_create_tbl": cpu_count(), + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 32766, + "max_sql_len": 32766, + "databases": None + } + + self.db = { + "name": 'db', + "drop": 'yes', + "replica": 1, + "days": 10, + "cache": 16, + "blocks": 6, + "precision": "ms", + "keep": 3650, + "minRows": 100, + "maxRows": 4096, + "comp": 2, + "walLevel": 1, + "cachelast": 0, + "quorum": 1, + "fsync": 3000, + "update": 0 + } + + self.query_cfg = { + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 2, + "query_mode": "taosc", + "specified_table_query": None, + "super_table_query": None + } + + self.table_query = { + "query_interval": 1, + "concurrent": 3, + "sqls": None + } + + self.stable_query = { + "stblname": "stb", + "query_interval": 1, + "threads": 3, + "sqls": None + } + + self.sub_cfg = { + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": None, + "super_table_query": None + } + + self.table_sub = { + "concurrent": 1, + "mode": "sync", + "interval": 10000, + "restart": "yes", + "keepProgress": "yes", + "sqls": None + } + + self.stable_sub = { + "stblname": "stb", + "threads": 1, + "mode": "sync", + "interval": 10000, + "restart": "yes", + "keepProgress": "yes", + "sqls": None + } + + self.stbs = [] + self.stb_template = { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 100, + "childtable_prefix": "stb_", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": 10, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 32766, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count": 1}], + "tags": [{"type": "BIGINT", "count": 1}] + } + + self.tb_query_sql = [] + self.tb_query_sql_template = { + "sql": "select last_row(*) from stb_0 ", + "result": "temp/query_res0.txt" + } + + self.stb_query_sql = [] + self.stb_query_sql_template = { + "sql": "select last_row(ts) from xxxx", + "result": "temp/query_res2.txt" + } + + self.tb_sub_sql = [] + self.tb_sub_sql_template = { + "sql": "select * from stb_0 ;", + "result": "temp/subscribe_res0.txt" + } + + self.stb_sub_sql = [] + self.stb_sub_sql_template = { + "sql": "select * from xxxx where ts > '2021-02-25 11:35:00.000' ;", + "result": "temp/subscribe_res1.txt" + } + + # The following functions are import functions for different dicts and lists + # except import_sql, all other import functions will a dict and overwrite the origional dict + # dict_in: the dict used to overwrite the target + def import_insert_cfg(self, dict_in): + self.insert_cfg = dict_in + + def import_db(self, dict_in): + self.db = dict_in + + def import_stbs(self, dict_in): + self.stbs = dict_in + + def import_query_cfg(self, dict_in): + self.query_cfg = dict_in + + def import_table_query(self, dict_in): + self.table_query = dict_in + + def import_stable_query(self, dict_in): + self.stable_query = dict_in + + def import_sub_cfg(self, dict_in): + self.sub_cfg = dict_in + + def import_table_sub(self, dict_in): + self.table_sub = dict_in + + def import_stable_sub(self, dict_in): + self.stable_sub = dict_in + + def import_sql(self, Sql_in, mode): + """used for importing the sql later used + + Args: + Sql_in (dict): the imported sql dict + mode (str): the sql storing location within TDTaosdemoCfg + format: 'fileType_tableType' + fileType: query, sub + tableType: table, stable + """ + if mode == 'query_table': + self.tb_query_sql = Sql_in + elif mode == 'query_stable': + self.stb_query_sql = Sql_in + elif mode == 'sub_table': + self.tb_sub_sql = Sql_in + elif mode == 'sub_stable': + self.stb_sub_sql = Sql_in + # import functions end + + # The following functions are alter functions for different dicts + # Args: + # key: the key that is going to be modified + # value: the value of the key that is going to be modified + # if key = 'databases' | "specified_table_query" | "super_table_query"|"sqls" + # value will not be used + + def alter_insert_cfg(self, key, value): + + if key == 'databases': + self.insert_cfg[key] = [ + { + 'dbinfo': self.db, + 'super_tables': self.stbs + } + ] + else: + self.insert_cfg[key] = value + + def alter_db(self, key, value): + self.db[key] = value + + def alter_query_tb(self, key, value): + if key == "sqls": + self.table_query[key] = self.tb_query_sql + else: + self.table_query[key] = value + + def alter_query_stb(self, key, value): + if key == "sqls": + self.stable_query[key] = self.stb_query_sql + else: + self.stable_query[key] = value + + def alter_query_cfg(self, key, value): + if key == "specified_table_query": + self.query_cfg["specified_table_query"] = self.table_query + elif key == "super_table_query": + self.query_cfg["super_table_query"] = self.stable_query + else: + self.query_cfg[key] = value + + def alter_sub_cfg(self, key, value): + if key == "specified_table_query": + self.sub_cfg["specified_table_query"] = self.table_sub + elif key == "super_table_query": + self.sub_cfg["super_table_query"] = self.stable_sub + else: + self.sub_cfg[key] = value + + def alter_sub_stb(self, key, value): + if key == "sqls": + self.stable_sub[key] = self.stb_sub_sql + else: + self.stable_sub[key] = value + + def alter_sub_tb(self, key, value): + if key == "sqls": + self.table_sub[key] = self.tb_sub_sql + else: + self.table_sub[key] = value + # alter function ends + + # the following functions are for handling the sql lists + def append_sql_stb(self, target, value): + """for appending sql dict into specific sql list + + Args: + target (str): the target append list + format: 'fileType_tableType' + fileType: query, sub + tableType: table, stable + unique: 'insert_stbs' + value (dict): the sql dict going to be appended + """ + if target == 'insert_stbs': + self.stbs.append(value) + elif target == 'query_table': + self.tb_query_sql.append(value) + elif target == 'query_stable': + self.stb_query_sql.append(value) + elif target == 'sub_table': + self.tb_sub_sql.append(value) + elif target == 'sub_stable': + self.stb_sub_sql.append(value) + + def pop_sql_stb(self, target, index): + """for poping a sql dict from specific sql list + + Args: + target (str): the target append list + format: 'fileType_tableType' + fileType: query, sub + tableType: table, stable + unique: 'insert_stbs' + index (int): the sql dict that is going to be popped + """ + if target == 'insert_stbs': + self.stbs.pop(index) + elif target == 'query_table': + self.tb_query_sql.pop(index) + elif target == 'query_stable': + self.stb_query_sql.pop(index) + elif target == 'sub_table': + self.tb_sub_sql.pop(index) + elif target == 'sub_stable': + self.stb_sub_sql.pop(index) + # sql list modification function end + + # The following functions are get functions for different dicts + def get_db(self): + return self.db + + def get_stb(self): + return self.stbs + + def get_insert_cfg(self): + return self.insert_cfg + + def get_query_cfg(self): + return self.query_cfg + + def get_tb_query(self): + return self.table_query + + def get_stb_query(self): + return self.stable_query + + def get_sub_cfg(self): + return self.sub_cfg + + def get_tb_sub(self): + return self.table_sub + + def get_stb_sub(self): + return self.stable_sub + + def get_sql(self, target): + """general get function for all sql lists + + Args: + target (str): the sql list want to get + format: 'fileType_tableType' + fileType: query, sub + tableType: table, stable + unique: 'insert_stbs' + """ + if target == 'query_table': + return self.tb_query_sql + elif target == 'query_stable': + return self.stb_query_sql + elif target == 'sub_table': + return self.tb_sub_sql + elif target == 'sub_stable': + return self.stb_sub_sql + + def get_template(self, target): + """general get function for the default sql template + + Args: + target (str): the sql list want to get + format: 'fileType_tableType' + fileType: query, sub + tableType: table, stable + unique: 'insert_stbs' + """ + if target == 'insert_stbs': + return self.stb_template + elif target == 'query_table': + return self.tb_query_sql_template + elif target == 'query_stable': + return self.stb_query_sql_template + elif target == 'sub_table': + return self.tb_sub_sql_template + elif target == 'sub_stable': + return self.stb_sub_sql_template + else: + print(f'did not find {target}') + + # the folloing are the file generation functions + """defalut document: + generator functio for generating taosdemo json file + will assemble the dicts and dump the final json + + Args: + pathName (str): the directory wanting the json file to be + fileName (str): the name suffix of the json file + Returns: + str: [pathName]/[filetype]_[filName].json + """ + + def generate_insert_cfg(self, pathName, fileName): + cfgFileName = f'{pathName}/insert_{fileName}.json' + self.alter_insert_cfg('databases', None) + with open(cfgFileName, 'w') as file: + json.dump(self.insert_cfg, file) + return cfgFileName + + def generate_query_cfg(self, pathName, fileName): + cfgFileName = f'{pathName}/query_{fileName}.json' + self.alter_query_tb('sqls', None) + self.alter_query_stb('sqls', None) + self.alter_query_cfg('specified_table_query', None) + self.alter_query_cfg('super_table_query', None) + with open(cfgFileName, 'w') as file: + json.dump(self.query_cfg, file) + return cfgFileName + + def generate_subscribe_cfg(self, pathName, fileName): + cfgFileName = f'{pathName}/subscribe_{fileName}.json' + self.alter_sub_tb('sqls', None) + self.alter_sub_stb('sqls', None) + self.alter_sub_cfg('specified_table_query', None) + self.alter_sub_cfg('super_table_query', None) + with open(cfgFileName, 'w') as file: + json.dump(self.sub_cfg, file) + return cfgFileName + # file generation functions ends + + def drop_cfg_file(self, fileName): + os.remove(f'{fileName}') + + +taosdemoCfg = TDTaosdemoCfg() diff --git a/tests/pytest/wal/insertDataDb1.json b/tests/pytest/wal/insertDataDb1.json new file mode 100644 index 0000000000..1dce00a4d5 --- /dev/null +++ b/tests/pytest/wal/insertDataDb1.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db1", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} + diff --git a/tests/pytest/wal/insertDataDb1Replica2.json b/tests/pytest/wal/insertDataDb1Replica2.json new file mode 100644 index 0000000000..fec38bcdec --- /dev/null +++ b/tests/pytest/wal/insertDataDb1Replica2.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db1", + "drop": "yes", + "replica": 2, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 1000, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} + diff --git a/tests/pytest/wal/insertDataDb2.json b/tests/pytest/wal/insertDataDb2.json new file mode 100644 index 0000000000..2cf8af5805 --- /dev/null +++ b/tests/pytest/wal/insertDataDb2.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db2", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2000, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 2000, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/wal/insertDataDb2Newstab.json b/tests/pytest/wal/insertDataDb2Newstab.json new file mode 100644 index 0000000000..f9d0713385 --- /dev/null +++ b/tests/pytest/wal/insertDataDb2Newstab.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db2", + "drop": "no", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 0, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"yes", + "childtable_count": 1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/wal/insertDataDb2NewstabReplica2.json b/tests/pytest/wal/insertDataDb2NewstabReplica2.json new file mode 100644 index 0000000000..e052f2850f --- /dev/null +++ b/tests/pytest/wal/insertDataDb2NewstabReplica2.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db2", + "drop": "no", + "replica": 2, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 0, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"yes", + "childtable_count": 1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/wal/insertDataDb2Replica2.json b/tests/pytest/wal/insertDataDb2Replica2.json new file mode 100644 index 0000000000..121f70956a --- /dev/null +++ b/tests/pytest/wal/insertDataDb2Replica2.json @@ -0,0 +1,86 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db2", + "drop": "yes", + "replica": 2, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 365, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "walLevel":1, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2000, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 2000, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 0, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/pytest/wal/sdbComp.py b/tests/pytest/wal/sdbComp.py new file mode 100644 index 0000000000..c0ac02610f --- /dev/null +++ b/tests/pytest/wal/sdbComp.py @@ -0,0 +1,124 @@ +################################################################### +# 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 distutils.log import debug +import sys +import os +import taos +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import subprocess + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + + # set path para + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + + binPath = buildPath+ "/build/bin/" + testPath = buildPath[:buildPath.find("debug")] + walFilePath = testPath + "/sim/dnode1/data/mnode_bak/wal/" + + #new db and insert data + os.system("rm -rf %s/sim/dnode1/data/mnode_tmp/" % testPath) + os.system("rm -rf %s/sim/dnode1/data/mnode_bak/" % testPath) + tdSql.execute("drop database if exists db2") + os.system("%staosdemo -f wal/insertDataDb1.json -y " % binPath) + tdSql.execute("drop database if exists db1") + os.system("%staosdemo -f wal/insertDataDb2.json -y " % binPath) + tdSql.execute("drop table if exists db2.stb0") + os.system("%staosdemo -f wal/insertDataDb2Newstab.json -y " % binPath) + query_pid1 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid1) + tdSql.execute("use db2") + tdSql.execute("drop table if exists stb1_0") + tdSql.execute("drop table if exists stb1_1") + tdSql.execute("insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')") + tdSql.execute("alter table db2.stb0 add column col4 int") + tdSql.execute("alter table db2.stb0 drop column col2") + tdSql.execute("alter table db2.stb0 add tag t3 int;") + tdSql.execute("alter table db2.stb0 drop tag t1") + tdSql.execute("create table if not exists stb2_0 (ts timestamp, col0 int, col1 float) ") + tdSql.execute("insert into stb2_0 values(1614218412000,8637,78.861045)") + tdSql.execute("alter table stb2_0 add column col2 binary(4)") + tdSql.execute("alter table stb2_0 drop column col1") + tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')") + + # stop taosd and compact wal file + tdDnodes.stop(1) + sleep(10) + os.system("nohup %s/taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & " %(binPath,testPath) ) + sleep(5) + assert os.path.exists(walFilePath) , "%s is not generated, compact didn't take effect " % walFilePath + + # use new wal file to start taosd + tdDnodes.start(1) + sleep(5) + tdSql.execute("reset query cache") + query_pid2 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid2) + + # verify that the data is correct + tdSql.execute("use db2") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + tdSql.query("select count (tbname) from stb1") + tdSql.checkRows(0) + tdSql.query("select count(*) from stb0_0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb2_0") + tdSql.checkData(0, 0, 2) + + # delete useless file + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf wal/%s.sql" % testcaseFilename ) + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/wal/sdbCompCluster.py b/tests/pytest/wal/sdbCompCluster.py new file mode 100644 index 0000000000..4fa84817ec --- /dev/null +++ b/tests/pytest/wal/sdbCompCluster.py @@ -0,0 +1,135 @@ +################################################################### +# 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 +import sys +sys.path.insert(0, os.getcwd()) +from util.log import * +from util.sql import * +from util.dnodes import * +import taos +import threading + + +class TwoClients: + def initConnection(self): + self.host = "chenhaoran02" + self.user = "root" + self.password = "taosdata" + self.config = "/etc/taos/" + self.port =6030 + self.rowNum = 10 + self.ts = 1537146000000 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + walFilePath = "/var/lib/taos/mnode_bak/wal/" + + # new taos client + conn1 = taos.connect(host=self.host, user=self.user, password=self.password, config=self.config ) + print(conn1) + cur1 = conn1.cursor() + tdSql.init(cur1, True) + + # new db and insert data + os.system("rm -rf /var/lib/taos/mnode_bak/") + os.system("rm -rf /var/lib/taos/mnode_temp/") + tdSql.execute("drop database if exists db2") + os.system("%staosdemo -f wal/insertDataDb1.json -y " % binPath) + tdSql.execute("drop database if exists db1") + os.system("%staosdemo -f wal/insertDataDb2.json -y " % binPath) + tdSql.execute("drop table if exists db2.stb0") + os.system("%staosdemo -f wal/insertDataDb2Newstab.json -y " % binPath) + query_pid1 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid1) + tdSql.execute("use db2") + tdSql.execute("drop table if exists stb1_0") + tdSql.execute("drop table if exists stb1_1") + tdSql.execute("insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')") + tdSql.execute("alter table db2.stb0 add column col4 int") + tdSql.execute("alter table db2.stb0 drop column col2") + tdSql.execute("alter table db2.stb0 add tag t3 int") + tdSql.execute("alter table db2.stb0 drop tag t1") + tdSql.execute("create table if not exists stb2_0 (ts timestamp, col0 int, col1 float) ") + tdSql.execute("insert into stb2_0 values(1614218412000,8637,78.861045)") + tdSql.execute("alter table stb2_0 add column col2 binary(4)") + tdSql.execute("alter table stb2_0 drop column col1") + tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')") + + # stop taosd and compact wal file + os.system("ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -2") + sleep(10) + os.system("nohup taosd --compact-mnode-wal -c /etc/taos & ") + sleep(10) + os.system("nohup /usr/bin/taosd > /dev/null 2>&1 &") + sleep(4) + tdSql.execute("reset query cache") + query_pid2 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid2) + assert os.path.exists(walFilePath) , "%s is not generated " % walFilePath + + # new taos connecting to server + conn2 = taos.connect(host=self.host, user=self.user, password=self.password, config=self.config ) + print(conn2) + cur2 = conn2.cursor() + tdSql.init(cur2, True) + + # use new wal file to start up tasod + tdSql.query("show databases") + for i in range(tdSql.queryRows): + if tdSql.queryResult[i][0]=="db2": + assert tdSql.queryResult[i][4]==1 , "replica is wrong" + tdSql.execute("use db2") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + tdSql.query("select count (tbname) from stb1") + tdSql.checkRows(0) + tdSql.query("select count(*) from stb0_0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb2_0") + tdSql.checkData(0, 0, 2) + tdSql.query("select * from stb2_0") + tdSql.checkData(1, 2, 'R') + + # delete useless file + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf wal/%s.sql" % testcaseFilename ) + +clients = TwoClients() +clients.initConnection() +# clients.getBuildPath() +clients.run() \ No newline at end of file diff --git a/tests/pytest/wal/sdbCompClusterReplica2.py b/tests/pytest/wal/sdbCompClusterReplica2.py new file mode 100644 index 0000000000..117da8ca2f --- /dev/null +++ b/tests/pytest/wal/sdbCompClusterReplica2.py @@ -0,0 +1,136 @@ +################################################################### +# 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 +import sys +sys.path.insert(0, os.getcwd()) +from util.log import * +from util.sql import * +from util.dnodes import * +import taos +import threading + + +class TwoClients: + def initConnection(self): + self.host = "chenhaoran02" + self.user = "root" + self.password = "taosdata" + self.config = "/etc/taos/" + self.port =6030 + self.rowNum = 10 + self.ts = 1537146000000 + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + def run(self): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + binPath = buildPath+ "/build/bin/" + walFilePath = "/var/lib/taos/mnode_bak/wal/" + + # new taos client + conn1 = taos.connect(host=self.host, user=self.user, password=self.password, config=self.config ) + print(conn1) + cur1 = conn1.cursor() + tdSql.init(cur1, True) + + # new db and insert data + os.system("rm -rf /var/lib/taos/mnode_bak/") + os.system("rm -rf /var/lib/taos/mnode_temp/") + tdSql.execute("drop database if exists db2") + os.system("%staosdemo -f wal/insertDataDb1Replica2.json -y " % binPath) + tdSql.execute("drop database if exists db1") + os.system("%staosdemo -f wal/insertDataDb2Replica2.json -y " % binPath) + tdSql.execute("drop table if exists db2.stb0") + os.system("%staosdemo -f wal/insertDataDb2NewstabReplica2.json -y " % binPath) + query_pid1 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid1) + tdSql.execute("use db2") + tdSql.execute("drop table if exists stb1_0") + tdSql.execute("drop table if exists stb1_1") + tdSql.execute("insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')") + tdSql.execute("alter table db2.stb0 add column col4 int") + tdSql.execute("alter table db2.stb0 drop column col2") + tdSql.execute("alter table db2.stb0 add tag t3 int") + tdSql.execute("alter table db2.stb0 drop tag t1") + tdSql.execute("create table if not exists stb2_0 (ts timestamp, col0 int, col1 float) ") + tdSql.execute("insert into stb2_0 values(1614218412000,8637,78.861045)") + tdSql.execute("alter table stb2_0 add column col2 binary(4)") + tdSql.execute("alter table stb2_0 drop column col1") + tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')") + + + # stop taosd and compact wal file + os.system("ps -ef |grep taosd |grep -v 'grep' |awk '{print $2}'|xargs kill -2") + sleep(10) + os.system("nohup taosd --compact-mnode-wal -c /etc/taos & ") + sleep(10) + os.system("nohup /usr/bin/taosd > /dev/null 2>&1 &") + sleep(4) + tdSql.execute("reset query cache") + query_pid2 = int(subprocess.getstatusoutput('ps aux|grep taosd |grep -v "grep"|awk \'{print $2}\'')[1]) + print(query_pid2) + assert os.path.exists(walFilePath) , "%s is not generated " % walFilePath + + # new taos connecting to server + conn2 = taos.connect(host=self.host, user=self.user, password=self.password, config=self.config ) + print(conn2) + cur2 = conn2.cursor() + tdSql.init(cur2, True) + + # use new wal file to start up tasod + tdSql.query("show databases") + for i in range(tdSql.queryRows): + if tdSql.queryResult[i][0]=="db2": + assert tdSql.queryResult[i][4]==2 , "replica is wrong" + tdSql.execute("use db2") + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + tdSql.query("select count (tbname) from stb1") + tdSql.checkRows(0) + tdSql.query("select count(*) from stb0_0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 2) + tdSql.query("select count(*) from stb2_0") + tdSql.checkData(0, 0, 2) + tdSql.query("select * from stb2_0") + tdSql.checkData(1, 2, 'R') + + # delete useless file + testcaseFilename = os.path.split(__file__)[-1] + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf wal/%s.sql" % testcaseFilename ) + +clients = TwoClients() +clients.initConnection() +# clients.getBuildPath() +clients.run() \ No newline at end of file diff --git a/tests/test-all.sh b/tests/test-all.sh index 47e5de6aa0..6e7963e787 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -233,6 +233,10 @@ totalExampleFailed=0 if [ "${OS}" == "Linux" ]; then corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` + if [ -z "$corepath" ];then + echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied" + corepath="/coredump/" + fi fi if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index c5b8d5c5eb..7d74946e93 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -813,8 +813,15 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { value[length[i]] = 0; // snprintf(value, fields[i].bytes, "%s", (char *)row[i]); break; - case TSDB_DATA_TYPE_TIMESTAMP: - tt = *(int64_t *)row[i] / 1000; + case TSDB_DATA_TYPE_TIMESTAMP: { + int32_t precision = taos_result_precision(pSql); + if (precision == TSDB_TIME_PRECISION_MILLI) { + tt = (*(int64_t *)row[i]) / 1000; + } else if (precision == TSDB_TIME_PRECISION_MICRO) { + tt = (*(int64_t *)row[i]) / 1000000; + } else { + tt = (*(int64_t *)row[i]) / 1000000000; + } /* comment out as it make testcases like select_with_tags.sim fail. but in windows, this may cause the call to localtime crash if tt < 0, need to find a better solution. @@ -829,9 +836,16 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { tp = localtime(&tt); strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", tp); - sprintf(value, "%s.%03d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000)); + if (precision == TSDB_TIME_PRECISION_MILLI) { + sprintf(value, "%s.%03d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000)); + } else if (precision == TSDB_TIME_PRECISION_MICRO) { + sprintf(value, "%s.%06d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000000)); + } else { + sprintf(value, "%s.%09d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000000000)); + } break; + } default: break; } // end of switch diff --git a/tests/tsim/src/simMain.c b/tests/tsim/src/simMain.c index 6a9d96bc3b..7d74c62c7d 100644 --- a/tests/tsim/src/simMain.c +++ b/tests/tsim/src/simMain.c @@ -35,7 +35,7 @@ int32_t main(int32_t argc, char *argv[]) { for (int32_t i = 1; i < argc; ++i) { if (strcmp(argv[i], "-c") == 0 && i < argc - 1) { - tstrncpy(configDir, argv[++i], MAX_FILE_NAME_LEN); + tstrncpy(configDir, argv[++i], 128); } else if (strcmp(argv[i], "-f") == 0 && i < argc - 1) { strcpy(scriptFile, argv[++i]); } else if (strcmp(argv[i], "-a") == 0) { @@ -75,4 +75,4 @@ int32_t main(int32_t argc, char *argv[]) { simInfo("execute result %d", ret); return ret; -} \ No newline at end of file +}