Merge branch 'master' into feature/TD-5918
This commit is contained in:
commit
5a32496f81
|
@ -44,7 +44,8 @@ echo "version=${version}"
|
||||||
#docker manifest rm tdengine/tdengine
|
#docker manifest rm tdengine/tdengine
|
||||||
#docker manifest rm tdengine/tdengine:${version}
|
#docker manifest rm tdengine/tdengine:${version}
|
||||||
if [ "$verType" == "beta" ]; then
|
if [ "$verType" == "beta" ]; then
|
||||||
docker manifest rm tdengine/tdengine:latest
|
docker manifest inspect tdengine/tdengine-beta:latest
|
||||||
|
docker manifest rm tdengine/tdengine-beta:latest
|
||||||
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
|
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
|
||||||
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
|
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
|
||||||
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
||||||
|
@ -52,6 +53,7 @@ if [ "$verType" == "beta" ]; then
|
||||||
docker manifest push tdengine/tdengine-beta:${version}
|
docker manifest push tdengine/tdengine-beta:${version}
|
||||||
|
|
||||||
elif [ "$verType" == "stable" ]; then
|
elif [ "$verType" == "stable" ]; then
|
||||||
|
docker manifest inspect tdengine/tdengine:latest
|
||||||
docker manifest rm tdengine/tdengine:latest
|
docker manifest rm tdengine/tdengine:latest
|
||||||
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
|
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
|
||||||
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
|
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: tdengine
|
name: tdengine
|
||||||
base: core18
|
base: core18
|
||||||
version: '2.1.5.0'
|
version: '2.1.6.0'
|
||||||
icon: snap/gui/t-dengine.svg
|
icon: snap/gui/t-dengine.svg
|
||||||
summary: an open-source big data platform designed and optimized for IoT.
|
summary: an open-source big data platform designed and optimized for IoT.
|
||||||
description: |
|
description: |
|
||||||
|
@ -72,7 +72,7 @@ parts:
|
||||||
- usr/bin/taosd
|
- usr/bin/taosd
|
||||||
- usr/bin/taos
|
- usr/bin/taos
|
||||||
- usr/bin/taosdemo
|
- usr/bin/taosdemo
|
||||||
- usr/lib/libtaos.so.2.1.5.0
|
- usr/lib/libtaos.so.2.1.6.0
|
||||||
- usr/lib/libtaos.so.1
|
- usr/lib/libtaos.so.1
|
||||||
- usr/lib/libtaos.so
|
- usr/lib/libtaos.so
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,6 @@ typedef struct SArguments_S {
|
||||||
uint32_t disorderRatio; // 0: no disorder, >0: x%
|
uint32_t disorderRatio; // 0: no disorder, >0: x%
|
||||||
int disorderRange; // ms, us or ns. accordig to database precision
|
int disorderRange; // ms, us or ns. accordig to database precision
|
||||||
uint32_t method_of_delete;
|
uint32_t method_of_delete;
|
||||||
char ** arg_list;
|
|
||||||
uint64_t totalInsertRows;
|
uint64_t totalInsertRows;
|
||||||
uint64_t totalAffectedRows;
|
uint64_t totalAffectedRows;
|
||||||
bool demo_mode; // use default column name and semi-random data
|
bool demo_mode; // use default column name and semi-random data
|
||||||
|
@ -638,7 +637,6 @@ SArguments g_args = {
|
||||||
0, // disorderRatio
|
0, // disorderRatio
|
||||||
1000, // disorderRange
|
1000, // disorderRange
|
||||||
1, // method_of_delete
|
1, // method_of_delete
|
||||||
NULL, // arg_list
|
|
||||||
0, // totalInsertRows;
|
0, // totalInsertRows;
|
||||||
0, // totalAffectedRows;
|
0, // totalAffectedRows;
|
||||||
true, // demo_mode;
|
true, // demo_mode;
|
||||||
|
@ -6402,6 +6400,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
bool flagSleep = true;
|
bool flagSleep = true;
|
||||||
uint64_t sleepTimeTotal = 0;
|
uint64_t sleepTimeTotal = 0;
|
||||||
|
|
||||||
|
int percentComplete = 0;
|
||||||
|
int64_t totalRows = insertRows * pThreadInfo->ntables;
|
||||||
|
|
||||||
while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) {
|
while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) {
|
||||||
if ((flagSleep) && (insert_interval)) {
|
if ((flagSleep) && (insert_interval)) {
|
||||||
st = taosGetTimestampMs();
|
st = taosGetTimestampMs();
|
||||||
|
@ -6578,6 +6579,11 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->totalAffectedRows += affectedRows;
|
pThreadInfo->totalAffectedRows += affectedRows;
|
||||||
|
|
||||||
|
int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows;
|
||||||
|
if (currentPercent > percentComplete ) {
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent);
|
||||||
|
percentComplete = currentPercent;
|
||||||
|
}
|
||||||
int64_t currentPrintTime = taosGetTimestampMs();
|
int64_t currentPrintTime = taosGetTimestampMs();
|
||||||
if (currentPrintTime - lastPrintTime > 30*1000) {
|
if (currentPrintTime - lastPrintTime > 30*1000) {
|
||||||
printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n",
|
printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n",
|
||||||
|
@ -6599,6 +6605,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (percentComplete < 100)
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, percentComplete);
|
||||||
|
|
||||||
free_of_interlace:
|
free_of_interlace:
|
||||||
tmfree(pThreadInfo->buffer);
|
tmfree(pThreadInfo->buffer);
|
||||||
|
@ -6636,6 +6644,9 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->samplePos = 0;
|
pThreadInfo->samplePos = 0;
|
||||||
|
|
||||||
|
int percentComplete = 0;
|
||||||
|
int64_t totalRows = insertRows * pThreadInfo->ntables;
|
||||||
|
|
||||||
for (uint64_t tableSeq = pThreadInfo->start_table_from;
|
for (uint64_t tableSeq = pThreadInfo->start_table_from;
|
||||||
tableSeq <= pThreadInfo->end_table_to;
|
tableSeq <= pThreadInfo->end_table_to;
|
||||||
tableSeq ++) {
|
tableSeq ++) {
|
||||||
|
@ -6741,6 +6752,11 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->totalAffectedRows += affectedRows;
|
pThreadInfo->totalAffectedRows += affectedRows;
|
||||||
|
|
||||||
|
int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows;
|
||||||
|
if (currentPercent > percentComplete ) {
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent);
|
||||||
|
percentComplete = currentPercent;
|
||||||
|
}
|
||||||
int64_t currentPrintTime = taosGetTimestampMs();
|
int64_t currentPrintTime = taosGetTimestampMs();
|
||||||
if (currentPrintTime - lastPrintTime > 30*1000) {
|
if (currentPrintTime - lastPrintTime > 30*1000) {
|
||||||
printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n",
|
printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n",
|
||||||
|
@ -6763,6 +6779,8 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
__func__, __LINE__, pThreadInfo->samplePos);
|
__func__, __LINE__, pThreadInfo->samplePos);
|
||||||
}
|
}
|
||||||
} // tableSeq
|
} // tableSeq
|
||||||
|
if (percentComplete < 100)
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, percentComplete);
|
||||||
|
|
||||||
free_of_progressive:
|
free_of_progressive:
|
||||||
tmfree(pThreadInfo->buffer);
|
tmfree(pThreadInfo->buffer);
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#define GET_QID(_r) (((SQInfo*)((_r)->qinfo))->qId)
|
#define GET_QID(_r) (((SQInfo*)((_r)->qinfo))->qId)
|
||||||
|
|
||||||
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
|
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
|
||||||
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!(sq)))? (_q)->pExpr1[1].base.param[0].i64:1)
|
|
||||||
|
|
||||||
int32_t getOutputInterResultBufSize(SQueryAttr* pQueryAttr);
|
int32_t getOutputInterResultBufSize(SQueryAttr* pQueryAttr);
|
||||||
|
|
||||||
|
@ -60,6 +59,7 @@ SResultRowCellInfo* getResultCell(const SResultRow* pRow, int32_t index, int32_t
|
||||||
|
|
||||||
void* destroyQueryFuncExpr(SExprInfo* pExprInfo, int32_t numOfExpr);
|
void* destroyQueryFuncExpr(SExprInfo* pExprInfo, int32_t numOfExpr);
|
||||||
void* freeColumnInfo(SColumnInfo* pColumnInfo, int32_t numOfCols);
|
void* freeColumnInfo(SColumnInfo* pColumnInfo, int32_t numOfCols);
|
||||||
|
int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, bool stable);
|
||||||
|
|
||||||
static FORCE_INLINE SResultRow *getResultRow(SResultRowInfo *pResultRowInfo, int32_t slot) {
|
static FORCE_INLINE SResultRow *getResultRow(SResultRowInfo *pResultRowInfo, int32_t slot) {
|
||||||
assert(pResultRowInfo != NULL && slot >= 0 && slot < pResultRowInfo->size);
|
assert(pResultRowInfo != NULL && slot >= 0 && slot < pResultRowInfo->size);
|
||||||
|
@ -70,7 +70,7 @@ static FORCE_INLINE char* getPosInResultPage(SQueryAttr* pQueryAttr, tFilePage*
|
||||||
int32_t offset) {
|
int32_t offset) {
|
||||||
assert(rowOffset >= 0 && pQueryAttr != NULL);
|
assert(rowOffset >= 0 && pQueryAttr != NULL);
|
||||||
|
|
||||||
int32_t numOfRows = (int32_t)GET_ROW_PARAM_FOR_MULTIOUTPUT(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery);
|
int32_t numOfRows = (int32_t)getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery);
|
||||||
return ((char *)page->data) + rowOffset + offset * numOfRows;
|
return ((char *)page->data) + rowOffset + offset * numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2706,7 +2706,7 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i
|
||||||
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||||
int32_t MIN_ROWS_PER_PAGE = 4;
|
int32_t MIN_ROWS_PER_PAGE = 4;
|
||||||
|
|
||||||
*rowsize = (int32_t)(pQueryAttr->resultRowSize * GET_ROW_PARAM_FOR_MULTIOUTPUT(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
|
*rowsize = (int32_t)(pQueryAttr->resultRowSize * getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
|
||||||
int32_t overhead = sizeof(tFilePage);
|
int32_t overhead = sizeof(tFilePage);
|
||||||
|
|
||||||
// one page contains at least two rows
|
// one page contains at least two rows
|
||||||
|
@ -3630,7 +3630,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
|
||||||
// re-estabilish output buffer pointer.
|
// re-estabilish output buffer pointer.
|
||||||
int32_t functionId = pBInfo->pCtx[i].functionId;
|
int32_t functionId = pBInfo->pCtx[i].functionId;
|
||||||
if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE) {
|
if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE) {
|
||||||
pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[0].pOutput;
|
pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[i-1].pOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5298,7 +5298,7 @@ SOperatorInfo* createGlobalAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv,
|
||||||
SMultiwayMergeInfo* pInfo = calloc(1, sizeof(SMultiwayMergeInfo));
|
SMultiwayMergeInfo* pInfo = calloc(1, sizeof(SMultiwayMergeInfo));
|
||||||
|
|
||||||
pInfo->resultRowFactor =
|
pInfo->resultRowFactor =
|
||||||
(int32_t)(GET_ROW_PARAM_FOR_MULTIOUTPUT(pRuntimeEnv->pQueryAttr, pRuntimeEnv->pQueryAttr->topBotQuery, false));
|
(int32_t)(getRowNumForMultioutput(pRuntimeEnv->pQueryAttr, pRuntimeEnv->pQueryAttr->topBotQuery, false));
|
||||||
|
|
||||||
pRuntimeEnv->scanFlag = MERGE_STAGE; // TODO init when creating pCtx
|
pRuntimeEnv->scanFlag = MERGE_STAGE; // TODO init when creating pCtx
|
||||||
|
|
||||||
|
@ -6327,7 +6327,7 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera
|
||||||
SAggOperatorInfo* pInfo = calloc(1, sizeof(SAggOperatorInfo));
|
SAggOperatorInfo* pInfo = calloc(1, sizeof(SAggOperatorInfo));
|
||||||
|
|
||||||
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||||
int32_t numOfRows = (int32_t)(GET_ROW_PARAM_FOR_MULTIOUTPUT(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
|
int32_t numOfRows = (int32_t)(getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
|
||||||
|
|
||||||
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, numOfRows);
|
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, numOfRows);
|
||||||
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset);
|
pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset);
|
||||||
|
@ -6701,7 +6701,7 @@ SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperato
|
||||||
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
|
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
|
||||||
|
|
||||||
pQueryAttr->resultRowSize = (pQueryAttr->resultRowSize *
|
pQueryAttr->resultRowSize = (pQueryAttr->resultRowSize *
|
||||||
(int32_t)(GET_ROW_PARAM_FOR_MULTIOUTPUT(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery)));
|
(int32_t)(getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery)));
|
||||||
|
|
||||||
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
|
pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity);
|
||||||
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
|
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8, TSDB_DATA_TYPE_INT);
|
||||||
|
|
|
@ -30,6 +30,18 @@ typedef struct SCompSupporter {
|
||||||
int32_t order;
|
int32_t order;
|
||||||
} SCompSupporter;
|
} SCompSupporter;
|
||||||
|
|
||||||
|
int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, bool stable) {
|
||||||
|
if (pQueryAttr && (!stable)) {
|
||||||
|
for (int16_t i = 0; i < pQueryAttr->numOfOutput; ++i) {
|
||||||
|
if (pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_TOP || pQueryAttr->pExpr1[i].base.functionId == TSDB_FUNC_BOTTOM) {
|
||||||
|
return (int32_t)pQueryAttr->pExpr1[i].base.param[0].i64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t getOutputInterResultBufSize(SQueryAttr* pQueryAttr) {
|
int32_t getOutputInterResultBufSize(SQueryAttr* pQueryAttr) {
|
||||||
int32_t size = 0;
|
int32_t size = 0;
|
||||||
|
|
||||||
|
|
|
@ -3468,6 +3468,7 @@ void filterPrepare(void* expr, void* param) {
|
||||||
SArray *arr = (SArray *)(pCond->arr);
|
SArray *arr = (SArray *)(pCond->arr);
|
||||||
for (size_t i = 0; i < taosArrayGetSize(arr); i++) {
|
for (size_t i = 0; i < taosArrayGetSize(arr); i++) {
|
||||||
char* p = taosArrayGetP(arr, i);
|
char* p = taosArrayGetP(arr, i);
|
||||||
|
strtolower(varDataVal(p), varDataVal(p));
|
||||||
taosHashPut(pObj, varDataVal(p),varDataLen(p), &dummy, sizeof(dummy));
|
taosHashPut(pObj, varDataVal(p),varDataLen(p), &dummy, sizeof(dummy));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -383,6 +383,7 @@ python3 ./test.py -f insert/flushwhiledrop.py
|
||||||
python3 ./test.py -f insert/schemalessInsert.py
|
python3 ./test.py -f insert/schemalessInsert.py
|
||||||
python3 ./test.py -f alter/alterColMultiTimes.py
|
python3 ./test.py -f alter/alterColMultiTimes.py
|
||||||
python3 ./test.py -f query/queryWildcardLength.py
|
python3 ./test.py -f query/queryWildcardLength.py
|
||||||
|
python3 ./test.py -f query/queryTbnameUpperLower.py
|
||||||
|
|
||||||
#======================p4-end===============
|
#======================p4-end===============
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from util.log import tdLog
|
||||||
|
from util.cases import tdCases
|
||||||
|
from util.sql import tdSql
|
||||||
|
from util.common import tdCom
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def checkStbWhereIn(self):
|
||||||
|
'''
|
||||||
|
where in ---> upper lower mixed
|
||||||
|
'''
|
||||||
|
tdCom.cleanTb()
|
||||||
|
table_name = tdCom.getLongName(8, "letters_mixed")
|
||||||
|
table_name_sub = f'{table_name}_sub'
|
||||||
|
tb_name_lower = table_name_sub.lower()
|
||||||
|
tb_name_upper = table_name_sub.upper()
|
||||||
|
|
||||||
|
## create stb and tb
|
||||||
|
tdSql.execute(f'CREATE TABLE {table_name} (ts timestamp, id int, bi1 binary(20)) tags (si1 binary(20))')
|
||||||
|
tdSql.execute(f'create table {table_name_sub}1 using {table_name} tags ("{table_name_sub}1")')
|
||||||
|
tdSql.execute(f'create table {tb_name_lower}2 using {table_name} tags ("{tb_name_lower}2")')
|
||||||
|
tdSql.execute(f'create table {tb_name_upper}3 using {table_name} tags ("{tb_name_upper}3")')
|
||||||
|
|
||||||
|
## insert values
|
||||||
|
tdSql.execute(f'insert into {table_name_sub}1 values (now-1s, 1, "{table_name_sub}1")')
|
||||||
|
tdSql.execute(f'insert into {tb_name_lower}2 values (now-2s, 2, "{tb_name_lower}21")')
|
||||||
|
tdSql.execute(f'insert into {tb_name_lower}2 values (now-3s, 3, "{tb_name_lower}22")')
|
||||||
|
tdSql.execute(f'insert into {tb_name_upper}3 values (now-4s, 4, "{tb_name_upper}31")')
|
||||||
|
tdSql.execute(f'insert into {tb_name_upper}3 values (now-5s, 5, "{tb_name_upper}32")')
|
||||||
|
tdSql.execute(f'insert into {tb_name_upper}3 values (now-6s, 6, "{tb_name_upper}33")')
|
||||||
|
|
||||||
|
## query where tbname in single
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{table_name_sub}1")')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{table_name_sub.upper()}1")')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{table_name_sub.lower()}1")')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{tb_name_lower}2")')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{tb_name_lower.upper()}2")')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{tb_name_upper}3")')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{tb_name_upper.lower()}3")')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
## query where tbname in multi
|
||||||
|
tdSql.query(f'select * from {table_name} where id=5 and tbname in ("{table_name_sub}1", "{tb_name_lower.upper()}2", "{tb_name_upper.lower()}3")')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.query(f'select * from {table_name} where tbname in ("{table_name_sub}1", "{tb_name_lower.upper()}2", "{tb_name_upper.lower()}3")')
|
||||||
|
tdSql.checkRows(6)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
self.checkStbWhereIn()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -53,6 +53,9 @@ class TDTestCase:
|
||||||
"select * from cars where id=0 and tbname in ('carzero', 'cartwo')")
|
"select * from cars where id=0 and tbname in ('carzero', 'cartwo')")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
tdSql.query("select * from cars where tbname in ('carZero', 'CARONE')")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tdSql.query("select * from cars where tbname like 'car%'")
|
tdSql.query("select * from cars where tbname like 'car%'")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
|
@ -19,11 +19,16 @@ import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
class taosdemoPerformace:
|
class taosdemoPerformace:
|
||||||
def __init__(self, commitID, dbName, branch, type):
|
def __init__(self, commitID, dbName, branch, type, numOfTables, numOfRows, numOfInt, numOfDouble, numOfBinary):
|
||||||
self.commitID = commitID
|
self.commitID = commitID
|
||||||
self.dbName = dbName
|
self.dbName = dbName
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
self.type = type
|
self.type = type
|
||||||
|
self.numOfTables = numOfTables
|
||||||
|
self.numOfRows = numOfRows
|
||||||
|
self.numOfInt = numOfInt
|
||||||
|
self.numOfDouble = numOfDouble
|
||||||
|
self.numOfBinary = numOfBinary
|
||||||
self.host = "127.0.0.1"
|
self.host = "127.0.0.1"
|
||||||
self.user = "root"
|
self.user = "root"
|
||||||
self.password = "taosdata"
|
self.password = "taosdata"
|
||||||
|
@ -51,13 +56,13 @@ class taosdemoPerformace:
|
||||||
stb = {
|
stb = {
|
||||||
"name": "meters",
|
"name": "meters",
|
||||||
"child_table_exists": "no",
|
"child_table_exists": "no",
|
||||||
"childtable_count": 10000,
|
"childtable_count": self.numOfTables,
|
||||||
"childtable_prefix": "stb_",
|
"childtable_prefix": "stb_",
|
||||||
"auto_create_table": "no",
|
"auto_create_table": "no",
|
||||||
"data_source": "rand",
|
"data_source": "rand",
|
||||||
"batch_create_tbl_num": 10,
|
"batch_create_tbl_num": 10,
|
||||||
"insert_mode": "taosc",
|
"insert_mode": "taosc",
|
||||||
"insert_rows": 100000,
|
"insert_rows": self.numOfRows,
|
||||||
"interlace_rows": 100,
|
"interlace_rows": 100,
|
||||||
"max_sql_len": 1024000,
|
"max_sql_len": 1024000,
|
||||||
"disorder_ratio": 0,
|
"disorder_ratio": 0,
|
||||||
|
@ -68,7 +73,9 @@ class taosdemoPerformace:
|
||||||
"sample_file": "./sample.csv",
|
"sample_file": "./sample.csv",
|
||||||
"tags_file": "",
|
"tags_file": "",
|
||||||
"columns": [
|
"columns": [
|
||||||
{"type": "INT", "count": 4}
|
{"type": "INT", "count": self.numOfInt},
|
||||||
|
{"type": "DOUBLE", "count": self.numOfDouble},
|
||||||
|
{"type": "BINARY", "len": 128, "count": self.numOfBinary}
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
{"type": "INT", "count": 1},
|
{"type": "INT", "count": 1},
|
||||||
|
@ -76,6 +83,7 @@ class taosdemoPerformace:
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stables = []
|
stables = []
|
||||||
stables.append(stb)
|
stables.append(stb)
|
||||||
|
|
||||||
|
@ -163,7 +171,7 @@ class taosdemoPerformace:
|
||||||
|
|
||||||
cursor.execute("create database if not exists %s" % self.dbName)
|
cursor.execute("create database if not exists %s" % self.dbName)
|
||||||
cursor.execute("use %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, branch binary(50), type binary(20))")
|
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, branch binary(50), type binary(20), numoftables int, numofrows int, numofint int, numofdouble int, numofbinary int)")
|
||||||
print("==================== taosdemo performance ====================")
|
print("==================== taosdemo performance ====================")
|
||||||
print("create tables time: %f" % float(self.createTableTime))
|
print("create tables time: %f" % float(self.createTableTime))
|
||||||
print("insert records time: %f" % float(self.insertRecordsTime))
|
print("insert records time: %f" % float(self.insertRecordsTime))
|
||||||
|
@ -171,13 +179,14 @@ class taosdemoPerformace:
|
||||||
print("avg delay: %f" % float(self.avgDelay))
|
print("avg delay: %f" % float(self.avgDelay))
|
||||||
print("max delay: %f" % float(self.maxDelay))
|
print("max delay: %f" % float(self.maxDelay))
|
||||||
print("min delay: %f" % 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, '%s', '%s')" %
|
cursor.execute("insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f, '%s', '%s', %d, %d, %d, %d, %d)" %
|
||||||
(float(self.createTableTime), float(self.insertRecordsTime), float(self.recordsPerSecond),
|
(float(self.createTableTime), float(self.insertRecordsTime), float(self.recordsPerSecond),
|
||||||
self.commitID, float(self.avgDelay), float(self.maxDelay), float(self.minDelay), self.branch, self.type))
|
self.commitID, float(self.avgDelay), float(self.maxDelay), float(self.minDelay), self.branch,
|
||||||
|
self.type, self.numOfTables, self.numOfRows, self.numOfInt, self.numOfDouble, self.numOfBinary))
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
cursor1 = self.conn.cursor()
|
cursor1 = self.conn.cursor()
|
||||||
cursor1.execute("drop database if exists %s" % self.insertDB)
|
# cursor1.execute("drop database if exists %s" % self.insertDB)
|
||||||
cursor1.close()
|
cursor1.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -209,8 +218,43 @@ if __name__ == '__main__':
|
||||||
default='glibc',
|
default='glibc',
|
||||||
type=str,
|
type=str,
|
||||||
help='build type (default: glibc)')
|
help='build type (default: glibc)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-i',
|
||||||
|
'--num-of-int',
|
||||||
|
action='store',
|
||||||
|
default=4,
|
||||||
|
type=int,
|
||||||
|
help='num of int columns (default: 4)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-D',
|
||||||
|
'--num-of-double',
|
||||||
|
action='store',
|
||||||
|
default=0,
|
||||||
|
type=int,
|
||||||
|
help='num of double columns (default: 4)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-B',
|
||||||
|
'--num-of-binary',
|
||||||
|
action='store',
|
||||||
|
default=0,
|
||||||
|
type=int,
|
||||||
|
help='num of binary columns (default: 4)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-t',
|
||||||
|
'--num-of-tables',
|
||||||
|
action='store',
|
||||||
|
default=10000,
|
||||||
|
type=int,
|
||||||
|
help='num of tables (default: 10000)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-r',
|
||||||
|
'--num-of-rows',
|
||||||
|
action='store',
|
||||||
|
default=100000,
|
||||||
|
type=int,
|
||||||
|
help='num of rows (default: 100000)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
perftest = taosdemoPerformace(args.commit_id, args.database_name, args.git_branch, args.build_type)
|
perftest = taosdemoPerformace(args.commit_id, args.database_name, args.git_branch, args.build_type, args.num_of_tables, args.num_of_rows, args.num_of_int, args.num_of_double, args.num_of_binary)
|
||||||
perftest.insertData()
|
perftest.insertData()
|
||||||
perftest.createTablesAndStoreData()
|
perftest.createTablesAndStoreData()
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
###################################################################
|
||||||
|
# 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 string
|
||||||
|
from util.sql import tdSql
|
||||||
|
|
||||||
|
class TDCom:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def cleanTb(self):
|
||||||
|
query_sql = "show stables"
|
||||||
|
res_row_list = tdSql.query(query_sql, True)
|
||||||
|
stb_list = map(lambda x: x[0], res_row_list)
|
||||||
|
for stb in stb_list:
|
||||||
|
tdSql.execute(f'drop table if exists {stb}')
|
||||||
|
|
||||||
|
query_sql = "show tables"
|
||||||
|
res_row_list = tdSql.query(query_sql, True)
|
||||||
|
tb_list = map(lambda x: x[0], res_row_list)
|
||||||
|
for tb in tb_list:
|
||||||
|
tdSql.execute(f'drop table if exists {tb}')
|
||||||
|
|
||||||
|
def getLongName(self, len, mode = "mixed"):
|
||||||
|
"""
|
||||||
|
generate long name
|
||||||
|
mode could be numbers/letters/letters_mixed/mixed
|
||||||
|
"""
|
||||||
|
if mode == "numbers":
|
||||||
|
chars = ''.join(random.choice(string.digits) for i in range(len))
|
||||||
|
elif mode == "letters":
|
||||||
|
chars = ''.join(random.choice(string.ascii_letters.lower()) for i in range(len))
|
||||||
|
elif mode == "letters_mixed":
|
||||||
|
chars = ''.join(random.choice(string.ascii_letters.upper() + string.ascii_letters.lower()) for i in range(len))
|
||||||
|
else:
|
||||||
|
chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len))
|
||||||
|
return chars
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.cursor.close()
|
||||||
|
|
||||||
|
tdCom = TDCom()
|
|
@ -101,6 +101,30 @@ if $data11 != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
## tbname in can accpet Upper case table name
|
||||||
|
sql select count(*) from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data01 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data10 != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data11 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data20 != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data21 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
# multiple tbname in is not allowed NOW
|
# multiple tbname in is not allowed NOW
|
||||||
sql_error select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
|
sql_error select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
|
||||||
#if $rows != 4 then
|
#if $rows != 4 then
|
||||||
|
|
Loading…
Reference in New Issue