提交 4321012a 编写于 作者: wmmhello's avatar wmmhello

Merge branch 'main' of https://github.com/taosdata/TDengine into fix/TS-3222

......@@ -132,11 +132,15 @@ int32_t dmRunDnode(SDnode *pDnode) {
int32_t count = 0;
if (dmOpenNodes(pDnode) != 0) {
dError("failed to open nodes since %s", terrstr());
dmCloseNodes(pDnode);
return -1;
}
if (dmStartNodes(pDnode) != 0) {
dError("failed to start nodes since %s", terrstr());
dmSetStatus(pDnode, DND_STAT_STOPPED);
dmStopNodes(pDnode);
dmCloseNodes(pDnode);
return -1;
}
......
......@@ -936,8 +936,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
int tLen = 0;
if (tdbTbGet(pMeta->pUidIdx, &e.ctbEntry.suid, sizeof(tb_uid_t), &tData, &tLen) == 0) {
version = ((SUidIdxVal *)tData)[0].version;
STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = version};
STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = ((SUidIdxVal *)tData)[0].version};
if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &tData, &tLen) == 0) {
SDecoder tdc = {0};
SMetaEntry stbEntry = {0};
......
......@@ -88,6 +88,10 @@ void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double
}
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
if (pLoadInfo == NULL) {
return NULL;
}
for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
pLoadInfo[i].currentLoadBlockIndex = 1;
pLoadInfo[i].blockIndex[0] = -1;
......
......@@ -221,6 +221,71 @@ static FORCE_INLINE int32_t sifInitJsonParam(SNode *node, SIFParam *param, SIFCt
param->status = SFLT_COARSE_INDEX;
return 0;
}
static int32_t sifNeedConvertCond(SNode *l, SNode *r) {
if (nodeType(l) != QUERY_NODE_COLUMN || nodeType(r) != QUERY_NODE_VALUE) {
return 0;
}
SColumnNode *c = (SColumnNode *)l;
SValueNode *v = (SValueNode *)r;
int32_t ctype = c->node.resType.type;
int32_t vtype = v->node.resType.type;
if (!IS_VAR_DATA_TYPE(ctype) && IS_VAR_DATA_TYPE(vtype)) {
return 1;
}
return 0;
}
static int32_t sifInitParamValByCol(SNode *r, SNode *l, SIFParam *param, SIFCtx *ctx) {
param->status = SFLT_COARSE_INDEX;
SColumnNode *cn = (SColumnNode *)r;
SValueNode *vn = (SValueNode *)l;
if (vn->typeData == TSDB_DATA_TYPE_NULL && (vn->literal == NULL || strlen(vn->literal) == 0)) {
param->status = SFLT_NOT_INDEX;
return 0;
}
SDataType *pType = &cn->node.resType;
int32_t type = pType->type;
SDataType *pVType = &vn->node.resType;
int32_t vtype = pVType->type;
char *pData = nodesGetValueFromNode(vn);
int32_t valLen = 0;
char **value = &param->condValue;
if (IS_VAR_DATA_TYPE(type)) {
int32_t dataLen = varDataTLen(pData);
if (type == TSDB_DATA_TYPE_JSON) {
if (*pData == TSDB_DATA_TYPE_NULL) {
dataLen = 0;
} else if (*pData == TSDB_DATA_TYPE_NCHAR) {
dataLen = varDataTLen(pData);
} else if (*pData == TSDB_DATA_TYPE_DOUBLE) {
dataLen = LONG_BYTES;
} else if (*pData == TSDB_DATA_TYPE_BOOL) {
dataLen = CHAR_BYTES;
}
dataLen += CHAR_BYTES;
}
valLen = dataLen;
} else {
valLen = pType->bytes;
}
char *tv = taosMemoryCalloc(1, valLen + 1);
if (tv == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
memcpy(tv, pData, valLen);
*value = tv;
param->colId = -1;
param->colValType = (uint8_t)(vn->node.resType.type);
if (vn->literal != NULL && strlen(vn->literal) <= sizeof(param->colName)) {
memcpy(param->colName, vn->literal, strlen(vn->literal));
} else {
param->status = SFLT_NOT_INDEX;
}
return 0;
}
static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
param->status = SFLT_COARSE_INDEX;
switch (nodeType(node)) {
......@@ -317,8 +382,13 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
return TSDB_CODE_SUCCESS;
} else {
SIF_ERR_JRET(sifInitParam(node->pLeft, &paramList[0], ctx));
if (nParam > 1) {
// if (sifNeedConvertCond(node->pLeft, node->pRight)) {
// SIF_ERR_JRET(sifInitParamValByCol(node->pLeft, node->pRight, &paramList[1], ctx));
// } else {
SIF_ERR_JRET(sifInitParam(node->pRight, &paramList[1], ctx));
// }
// if (paramList[0].colValType == TSDB_DATA_TYPE_JSON &&
// ((SOperatorNode *)(node))->opType == OP_TYPE_JSON_CONTAINS) {
// return TSDB_CODE_OUT_OF_MEMORY;
......@@ -404,60 +474,149 @@ static FORCE_INLINE FilterFunc sifGetFilterFunc(EIndexQueryType type, bool *reve
}
return NULL;
}
int32_t sifStr2Num(char *buf, int32_t len, int8_t type, void *val) {
// signed/unsigned/float
if (IS_SIGNED_NUMERIC_TYPE(type)) {
int64_t v = 0;
if (0 != toInteger(buf, len, 10, &v)) {
return -1;
}
if (type == TSDB_DATA_TYPE_BIGINT) {
*(int64_t *)val = v;
} else if (type == TSDB_DATA_TYPE_INT) {
*(int32_t *)val = v;
} else if (type == TSDB_DATA_TYPE_TINYINT) {
*(int8_t *)val = v;
} else if (type == TSDB_DATA_TYPE_SMALLINT) {
*(int16_t *)val = v;
}
} else if (IS_FLOAT_TYPE(type)) {
if (type == TSDB_DATA_TYPE_FLOAT) {
*(float *)val = taosStr2Float(buf, NULL);
} else {
*(double *)val = taosStr2Double(buf, NULL);
}
} else if (IS_UNSIGNED_NUMERIC_TYPE(type)) {
uint64_t v = 0;
if (0 != toUInteger(buf, len, 10, &v)) {
return -1;
}
if (type == TSDB_DATA_TYPE_UBIGINT) {
*(uint64_t *)val = v;
} else if (type == TSDB_DATA_TYPE_UINT) {
*(uint32_t *)val = v;
} else if (type == TSDB_DATA_TYPE_UTINYINT) {
*(uint8_t *)val = v;
} else if (type == TSDB_DATA_TYPE_USMALLINT) {
*(uint16_t *)val = v;
}
} else {
return -1;
}
return 0;
}
static void sifSetFltParam(SIFParam *left, SIFParam *right, SDataTypeBuf *typedata, SMetaFltParam *param) {
int8_t ltype = left->colValType, rtype = right->colValType;
static int32_t sifSetFltParam(SIFParam *left, SIFParam *right, SDataTypeBuf *typedata, SMetaFltParam *param) {
int32_t code = 0;
int8_t ltype = left->colValType, rtype = right->colValType;
if (!IS_NUMERIC_TYPE(ltype) || !((IS_NUMERIC_TYPE(rtype)) || rtype == TSDB_DATA_TYPE_VARCHAR)) {
return -1;
}
if (ltype == TSDB_DATA_TYPE_FLOAT) {
float f = 0;
SIF_DATA_CONVERT(rtype, right->condValue, f);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, f);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_FLOAT, &f));
}
typedata->f = f;
param->val = &typedata->f;
} else if (ltype == TSDB_DATA_TYPE_DOUBLE) {
double d = 0;
SIF_DATA_CONVERT(rtype, right->condValue, d);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, d);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_DOUBLE, &d));
}
typedata->d = d;
param->val = &typedata->d;
} else if (ltype == TSDB_DATA_TYPE_BIGINT) {
int64_t i64 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, i64);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, i64);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_BIGINT, &i64));
}
typedata->i64 = i64;
param->val = &typedata->i64;
} else if (ltype == TSDB_DATA_TYPE_INT) {
int32_t i32 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, i32);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, i32);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_INT, &i32));
}
typedata->i32 = i32;
param->val = &typedata->i32;
} else if (ltype == TSDB_DATA_TYPE_SMALLINT) {
int16_t i16 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, i16);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, i16);
} else {
SIF_ERR_RET(
sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_SMALLINT, &i16));
}
typedata->i16 = i16;
param->val = &typedata->i16;
} else if (ltype == TSDB_DATA_TYPE_TINYINT) {
int8_t i8 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, i8)
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, i8);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_TINYINT, &i8));
}
typedata->i8 = i8;
param->val = &typedata->i8;
} else if (ltype == TSDB_DATA_TYPE_UBIGINT) {
uint64_t u64 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, u64);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, u64);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UBIGINT, &u64));
}
typedata->u64 = u64;
param->val = &typedata->u64;
} else if (ltype == TSDB_DATA_TYPE_UINT) {
uint32_t u32 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, u32);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, u32);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UINT, &u32));
}
typedata->u32 = u32;
param->val = &typedata->u32;
} else if (ltype == TSDB_DATA_TYPE_USMALLINT) {
uint16_t u16 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, u16);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, u16);
} else {
SIF_ERR_RET(
sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_USMALLINT, &u16));
}
typedata->u16 = u16;
param->val = &typedata->u16;
} else if (ltype == TSDB_DATA_TYPE_UTINYINT) {
uint8_t u8 = 0;
SIF_DATA_CONVERT(rtype, right->condValue, u8);
if (IS_NUMERIC_TYPE(rtype)) {
SIF_DATA_CONVERT(rtype, right->condValue, u8);
} else {
SIF_ERR_RET(sifStr2Num(varDataVal(right->condValue), varDataLen(right->condValue), TSDB_DATA_TYPE_UTINYINT, &u8));
}
typedata->u8 = u8;
param->val = &typedata->u8;
}
return 0;
}
static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFParam *output) {
int ret = 0;
......@@ -498,7 +657,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
param.val = buf;
}
} else {
sifSetFltParam(left, right, &typedata, &param);
if (sifSetFltParam(left, right, &typedata, &param) != 0) return -1;
}
ret = metaFilterTableIds(arg->metaEx, &param, output->result);
}
......
......@@ -52,7 +52,7 @@ void streamCleanUp() {
void streamSchedByTimer(void* param, void* tmrId) {
SStreamTask* pTask = (void*)param;
if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
if (streamTaskShouldStop(&pTask->status)) {
streamMetaReleaseTask(NULL, pTask);
return;
}
......
......@@ -171,7 +171,7 @@ void taosGetSystemLocale(char *outLocale, char *outCharset) {
strcpy(outLocale, "en_US.UTF-8");
} else {
tstrncpy(outLocale, locale, TD_LOCALE_LEN);
// printf("locale not configured, set to system default:%s", outLocale);
printf("locale not configured, set to system default:%s\n", outLocale);
}
// if user does not specify the charset, extract it from locale
......
......@@ -51,6 +51,16 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQuery_26.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/select_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
......
......@@ -303,7 +303,7 @@ function run_thread() {
if [ ! -z "$corefile" ]; then
echo -e "\e[34m corefiles: $corefile \e[0m"
local build_dir=$log_dir/build_${hosts[index]}
local remote_build_dir="${workdirs[index]}/{DEBUGPATH}/build"
local remote_build_dir="${workdirs[index]}/${DEBUGPATH}/build"
# if [ $ent -ne 0 ]; then
# remote_build_dir="${workdirs[index]}/{DEBUGPATH}/build"
# fi
......
......@@ -123,6 +123,17 @@ sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '1'
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -123,6 +123,15 @@ sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '1';
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1.0"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -123,6 +123,16 @@ sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1.0"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -123,6 +123,16 @@ sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '1'
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1";
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -85,10 +85,22 @@ sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '1'
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -115,14 +115,36 @@ sql select * from $mt where tgcol = 0
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '0'
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "0"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 0
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = 1
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = "1"
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol = '1'
if $rows != 100 then
return -1
endi
sql select * from $mt where tgcol <> 1
if $rows != 100 then
return -1
......
......@@ -17,12 +17,12 @@ from util.dnodes import TDDnode
from util.cluster import *
import subprocess
BASEVERSION = "3.0.1.8"
BASEVERSION = "3.0.2.3"
class TDTestCase:
def caseDescription(self):
'''
f'''
3.0 data compatibility test
case1: basedata version is 3.0.1.8
case1: basedata version is {BASEVERSION}
'''
return
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import random
import os
import time
import taos
import subprocess
from faker import Faker
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.testcasePath = os.path.split(__file__)[0]
self.testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.db = "sel_null"
def insert_data(self,database,vgroups):
num_random = 10
tdSql.execute('''drop database if exists %s ;''' %database)
tdSql.execute('''create database %s keep 36500 vgroups %d PRECISION 'us';'''%(database,vgroups))
tdSql.execute('''use %s;'''%database)
tdSql.execute('''create stable %s.stb0 (ts timestamp , c0 int , c1 double , c0null int , c1null double ) tags( t0 tinyint , t1 varchar(16) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint , t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);'''%database)
for i in range(5):
tdSql.execute('''create table %s.stb0_%d using %s.stb0 tags(%d,'varchar%d',%d,%d, %d, %d,%d,'binary%d','nchar%d',%d,%d,%d ) ;'''%(database,i,database,i,i,i,i,i,i,i,i,i,i,i,i))
# insert data
for i in range(num_random):
for j in range(50):
tdSql.execute('''insert into %s.stb0_0 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_1 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_2 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_3 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.execute('''insert into %s.stb0_4 (ts , c1 , c0) values(now, %d, %d) ;''' % (database,j,j))
tdSql.query("select count(*) from %s.stb0;" %database)
tdSql.checkData(0,0,5*num_random*50)
tdSql.query("select count(*) from %s.stb0_0;"%database)
tdSql.checkData(0,0,num_random*50)
def ts_3085(self,database):
sql = "select count(c0null) from(select * from %s.stb0 limit 20,4) "%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
offset = random.randint(10,100)
for i in range(offset):
sql = "select count(c0null) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select count(c1null) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select count(c0) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(c1) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(t0) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
sql = "select count(t1) from(select * from %s.stb0 limit %d,%d) "%(database,offset,i)
tdSql.query(sql)
tdSql.checkData(0,0,i)
def ts_2974_max(self,database):
sql = "select max(c0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c1) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c1),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,49)
sql = "select max(c0null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c0null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c1null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(c1null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select max(t0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t1) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t1),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_bool) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_bool),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_binary) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_binary),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_nchar) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_nchar),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_bigint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_bigint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_smallint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_smallint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_tinyint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_tinyint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_float) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_float),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_double) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
sql = "select max(t_double),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,4)
def ts_2974_min(self,database):
sql = "select min(c0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c1) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c1),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(c0null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c0null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c1null) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(c1null),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,"None")
sql = "select min(t0) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t0),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t1) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t1),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_bool) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_bool),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_binary) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_binary),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_nchar) from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_nchar),ts from %s.stb0 where ts<now;"%(database)
tdSql.error(sql)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_int),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_bigint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_bigint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_smallint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_smallint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_tinyint) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_tinyint),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_float) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_float),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_double) from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
sql = "select min(t_double),ts from %s.stb0 where ts<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,0)
def ts_2601(self,database):
tdSql.query("alter local 'keepcolumnname' '0';")
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now);"%(database)
tdSql.error(sql)
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"%(database)
tdSql.error(sql)
tdSql.query("alter local 'keepcolumnname' '1';")
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now);"%(database)
tdSql.query(sql)
sql = "select ts,c0 from (select last(*) from %s.stb0 where ts<now order by ts );"%(database)
tdSql.query(sql)
def ts_3108(self,database):
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')<now;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,2500)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2023-01-01 00:00:00.000')>now;"%(database)
tdSql.query(sql)
tdSql.checkRows(0)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')<now+1y;"%(database)
tdSql.query(sql)
tdSql.checkData(0,0,2500)
sql = "select count(*) from %s.stb0 where to_unixtimestamp('2024-01-01 00:00:00.000')>now+1y;"%(database)
tdSql.query(sql)
tdSql.checkRows(0)
def ts_3110(self,database):
sql1 = "select * from %s.stb0 order by ts desc limit 2;"%(database)
tdSql.query(sql1)
data1_0_0 = tdSql.getData(0,0)
data1_1_0 = tdSql.getData(1,0)
sql2 = "select * from (select * from %s.stb0 order by ts desc limit 2) order by ts;"%(database)
tdSql.query(sql2)
data2_0_0 = tdSql.getData(0,0)
data2_1_0 = tdSql.getData(1,0)
if (data1_0_0 == data2_1_0) and (data1_1_0 == data2_0_0):
tdLog.info("ts_3110: success")
else:
tdLog.exit("ts_3110: sql1 result:'%s' not equal sql2 result:'%s'" % (sql1,sql2))
def ts_3036(self,database):
sql1 = "select ts , c0 , c1 , c0null , c1null from (select ts , c0 , c1 , c0null , c1null from %s.stb0_0 where ts between now -1d and now +1d \
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_1 where ts between now -1d and now +1d \
union all select ts , c0 , c1 , c0null , c1null from %s.stb0_2 where ts between now -1d and now +1d ) tt \
where ts < now order by tt.ts desc limit 2;"%(database,database,database)
tdSql.query(sql1)
data1_0_0 = tdSql.getData(0,0)
data1_1_0 = tdSql.getData(1,0)
sql2 = "select ts , c0 , c1 , c0null , c1null from (select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts > now \
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts = now \
union all select tbname as tb, ts , c0 , c1 , c0null , c1null from %s.stb0 where ts < now ) tt \
where tt.ts between now -1d and now +1d and tt.tb in ('stb0_0','stb0_1','stb0_2') order by tt.ts desc limit 2;"%(database,database,database)
tdSql.query(sql2)
data2_0_0 = tdSql.getData(0,0)
data2_1_0 = tdSql.getData(1,0)
sql3 = "select ts , c0 , c1 , c0null , c1null from %s.stb0 \
where ts between now -1d and now +1d and tbname in ('stb0_0','stb0_1','stb0_2') order by ts desc limit 2;"%(database)
tdSql.query(sql3)
data3_0_0 = tdSql.getData(0,0)
data3_1_0 = tdSql.getData(1,0)
if (data1_0_0 == data2_0_0 == data3_0_0) and (data1_1_0 == data2_1_0 == data3_1_0):
tdLog.info("ts_3036: success")
else:
tdLog.exit("ts_3036: sql1 result:'%s' not equal sql2 result:'%s' or not equal sql3 result:'%s'" % (sql1,sql2,sql3))
def ts_23569(self,database):
tdSql.query("alter local 'keepcolumnname' '0';")
sql = "alter table %s.stb0 drop tag t10;"%(database)
tdSql.error(sql)
error_msg = tdSql.error(sql)
include_msg = 'Invalid tag name'
if include_msg in error_msg:
tdLog.info("ts_23569: success")
else:
tdLog.exit("ts_23569: include_msg:'%s' not in error_msg:'%s'" % (include_msg,error_msg))
tdSql.query("alter local 'keepcolumnname' '1';")
sql = "alter table %s.stb0 drop tag t10;"%(database)
tdSql.error(sql)
error_msg = tdSql.error(sql)
include_msg = 'Invalid tag name'
if include_msg in error_msg:
tdLog.info("ts_23569: success")
else:
tdLog.exit("ts_23569: include_msg:'%s' not in error_msg:'%s'" % (include_msg,error_msg))
def ts_23505(self,database):
sql = "create table %s.`12345` (`567` timestamp,num int);"%(database)
tdSql.execute(sql)
sql = "insert into %s.12345 values (now,1);"%(database)
tdSql.error(sql)
sql = "insert into %s.`12345` values (now,1);"%(database)
tdSql.execute(sql)
sql = "select * from %s.`12345` order by `567` desc limit 2;"%(database)
tdSql.query(sql)
tdSql.checkData(0,1,1)
sql = "drop table %s.`12345` ;"%(database)
tdSql.execute(sql)
sql = "select * from %s.`12345` order by `567` desc limit 2;"%(database)
tdSql.error(sql)
def run(self):
startTime = time.time()
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
self.insert_data("%s" %self.db,2)
self.ts_3085("%s" %self.db)
self.ts_2974_max("%s" %self.db)
self.ts_2974_min("%s" %self.db)
self.ts_2601("%s" %self.db)
self.ts_23569("%s" %self.db)
self.ts_3108("%s" %self.db)
self.ts_3110("%s" %self.db)
self.ts_23505("%s" %self.db)
self.ts_3036("%s" %self.db)
tdSql.query("flush database %s" %self.db)
self.ts_2974_max("%s" %self.db)
self.ts_2974_min("%s" %self.db)
self.ts_3085("%s" %self.db)
self.ts_2601("%s" %self.db)
self.ts_23569("%s" %self.db)
self.ts_3108("%s" %self.db)
self.ts_3110("%s" %self.db)
self.ts_23505("%s" %self.db)
self.ts_3036("%s" %self.db)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
此差异已折叠。
......@@ -170,7 +170,7 @@ class TMQCom:
if tdSql.getData(i, 1) == 1:
loopFlag = 0
break
time.sleep(0.02)
time.sleep(0.10)
return
def create_database(self,tsql, dbName,dropFlag=1,vgroups=4,replica=1):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册