Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/tsdb_snapshot
This commit is contained in:
commit
e99169023f
|
@ -542,8 +542,10 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
|
|||
}
|
||||
|
||||
int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
|
||||
pBlock->info.rows = *(int32_t*)buf;
|
||||
int32_t numOfRows = *(int32_t*) buf;
|
||||
blockDataEnsureCapacity(pBlock, numOfRows);
|
||||
|
||||
pBlock->info.rows = numOfRows;
|
||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
const char* pStart = buf + sizeof(uint32_t);
|
||||
|
||||
|
@ -589,6 +591,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// todo remove this
|
||||
int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) {
|
||||
pBlock->info.rows = *(int32_t*)buf;
|
||||
pBlock->info.groupId = *(uint64_t*)(buf + sizeof(int32_t));
|
||||
|
|
|
@ -168,7 +168,12 @@ int32_t mmPutMsgToQueue(SMnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
|||
memcpy(pMsg, pRpc, sizeof(SRpcMsg));
|
||||
|
||||
dTrace("msg:%p, is created and will put into %s queue, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType));
|
||||
return mmPutMsgToWorker(pMgmt, pWorker, pMsg);
|
||||
int32_t code = mmPutMsgToWorker(pMgmt, pWorker, pMsg);
|
||||
if (code != 0) {
|
||||
dTrace("msg:%p, is freed", pMsg);
|
||||
taosFreeQitem(pMsg);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
|
||||
|
|
|
@ -853,6 +853,9 @@ static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) {
|
|||
w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
|
||||
} else {
|
||||
int64_t st = w.skey;
|
||||
if (pInterval->offset > 0) {
|
||||
st = taosTimeAdd(st, pInterval->offset, pInterval->offsetUnit, pInterval->precision);
|
||||
}
|
||||
|
||||
if (st > ts) {
|
||||
st -= ((st - ts + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding;
|
||||
|
|
|
@ -53,8 +53,8 @@ static void setNullRow(SSDataBlock* pBlock, int64_t ts, int32_t rowIndex) {
|
|||
// the first are always the timestamp column, so start from the second column.
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); ++i) {
|
||||
SColumnInfoData* p = taosArrayGet(pBlock->pDataBlock, i);
|
||||
if (p->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
colDataAppend(p, rowIndex, (const char*)&ts, false);
|
||||
if (p->info.type == TSDB_DATA_TYPE_TIMESTAMP) { // handle timestamp
|
||||
colDataAppend(p, rowIndex, (const char*)&ts, false);
|
||||
} else {
|
||||
colDataAppendNULL(p, rowIndex);
|
||||
}
|
||||
|
@ -83,15 +83,20 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
|
|||
if (pFillInfo->type == TSDB_FILL_PREV) {
|
||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev : pFillInfo->next;
|
||||
|
||||
for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
|
||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||
if (TSDB_COL_IS_TAG(pCol->flag)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
||||
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
|
||||
doSetVal(pDstColInfoData, index, pKey);
|
||||
|
||||
if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
colDataAppend(pDstColInfoData, index, (const char*)&ts, false);
|
||||
} else {
|
||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
||||
doSetVal(pDstColInfoData, index, pKey);
|
||||
}
|
||||
}
|
||||
} else if (pFillInfo->type == TSDB_FILL_NEXT) {
|
||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next : pFillInfo->prev;
|
||||
|
@ -264,9 +269,8 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
assert(pFillInfo->currentKey == ts);
|
||||
|
||||
if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) {
|
||||
++pFillInfo->index;
|
||||
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, pFillInfo->next);
|
||||
--pFillInfo->index;
|
||||
int32_t nextRowIndex = pFillInfo->index + 1;
|
||||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, pFillInfo->next);
|
||||
}
|
||||
|
||||
// assign rows to dst buffer
|
||||
|
|
|
@ -3461,9 +3461,16 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* +------------------------------------+--------------+--------------+
|
||||
* | null bitmap | | |
|
||||
* |(n columns, one bit for each column)| src column #1| src column #2|
|
||||
* +------------------------------------+--------------+--------------+
|
||||
*/
|
||||
void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pSrcBlock, STuplePos* pPos) {
|
||||
SFilePage* pPage = NULL;
|
||||
|
||||
// todo refactor: move away
|
||||
int32_t completeRowSize = pCtx->subsidiaries.num * sizeof(bool);
|
||||
for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) {
|
||||
SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j];
|
||||
|
@ -3476,12 +3483,15 @@ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS
|
|||
} else {
|
||||
pPage = getBufPage(pCtx->pBuf, pCtx->curBufPage);
|
||||
if (pPage->num + completeRowSize > getBufPageSize(pCtx->pBuf)) {
|
||||
// current page is all used, let's prepare a new buffer page
|
||||
releaseBufPage(pCtx->pBuf, pPage);
|
||||
pPage = getNewBufPage(pCtx->pBuf, 0, &pCtx->curBufPage);
|
||||
pPage->num = sizeof(SFilePage);
|
||||
}
|
||||
}
|
||||
|
||||
pPos->pageId = pCtx->curBufPage;
|
||||
pPos->offset = pPage->num;
|
||||
|
||||
// keep the current row data, extract method
|
||||
int32_t offset = 0;
|
||||
|
@ -3509,7 +3519,6 @@ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS
|
|||
offset += pCol->info.bytes;
|
||||
}
|
||||
|
||||
pPos->offset = pPage->num;
|
||||
pPage->num += completeRowSize;
|
||||
|
||||
setBufPageDirty(pPage, true);
|
||||
|
@ -4839,7 +4848,7 @@ static void doReservoirSample(SqlFunctionCtx* pCtx, SSampleInfo* pInfo, char* da
|
|||
if (pInfo->numSampled < pInfo->samples) {
|
||||
sampleAssignResult(pInfo, data, pInfo->numSampled);
|
||||
if (pCtx->subsidiaries.num > 0) {
|
||||
saveTupleData(pCtx, index, pCtx->pSrcBlock, pInfo->tuplePos + pInfo->numSampled * sizeof(STuplePos));
|
||||
saveTupleData(pCtx, index, pCtx->pSrcBlock, &pInfo->tuplePos[pInfo->numSampled]);
|
||||
}
|
||||
pInfo->numSampled++;
|
||||
} else {
|
||||
|
@ -4847,7 +4856,7 @@ static void doReservoirSample(SqlFunctionCtx* pCtx, SSampleInfo* pInfo, char* da
|
|||
if (j < pInfo->samples) {
|
||||
sampleAssignResult(pInfo, data, j);
|
||||
if (pCtx->subsidiaries.num > 0) {
|
||||
copyTupleData(pCtx, index, pCtx->pSrcBlock, pInfo->tuplePos + j * sizeof(STuplePos));
|
||||
copyTupleData(pCtx, index, pCtx->pSrcBlock, &pInfo->tuplePos[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4885,7 +4894,7 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
int32_t currentRow = pBlock->info.rows;
|
||||
for (int32_t i = 0; i < pInfo->numSampled; ++i) {
|
||||
colDataAppend(pCol, currentRow + i, pInfo->data + i * pInfo->colBytes, false);
|
||||
setSelectivityValue(pCtx, pBlock, pInfo->tuplePos + i * sizeof(STuplePos), currentRow + i);
|
||||
setSelectivityValue(pCtx, pBlock, &pInfo->tuplePos[i], currentRow + i);
|
||||
}
|
||||
|
||||
return pInfo->numSampled;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "ttime.h"
|
||||
|
||||
#define DEFAULT_FALSE_POSITIVE 0.01
|
||||
#define DEFAULT_BUCKET_SIZE 1024
|
||||
#define DEFAULT_BUCKET_SIZE 131072
|
||||
#define ROWS_PER_MILLISECOND 1
|
||||
#define MAX_NUM_SCALABLE_BF 100000
|
||||
#define MIN_NUM_SCALABLE_BF 10
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
# ./test.sh -f tsim/stream/schedSnode.sim
|
||||
./test.sh -f tsim/stream/windowClose.sim
|
||||
./test.sh -f tsim/stream/ignoreExpiredData.sim
|
||||
./test.sh -f tsim/stream/sliding.sim
|
||||
|
||||
# ---- transaction
|
||||
./test.sh -f tsim/trans/lossdata1.sim
|
||||
|
|
|
@ -127,8 +127,8 @@ echo "dataDir $DATA_DIR" >> $TAOS_CFG
|
|||
echo "logDir $LOG_DIR" >> $TAOS_CFG
|
||||
echo "debugFlag 0" >> $TAOS_CFG
|
||||
echo "tmrDebugFlag 131" >> $TAOS_CFG
|
||||
echo "uDebugFlag 131" >> $TAOS_CFG
|
||||
echo "rpcDebugFlag 131" >> $TAOS_CFG
|
||||
echo "uDebugFlag 143" >> $TAOS_CFG
|
||||
echo "rpcDebugFlag 143" >> $TAOS_CFG
|
||||
echo "jniDebugFlag 143" >> $TAOS_CFG
|
||||
echo "qDebugFlag 143" >> $TAOS_CFG
|
||||
echo "cDebugFlag 143" >> $TAOS_CFG
|
||||
|
|
|
@ -32,7 +32,6 @@ if $rows != 3 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print =============== insert data, mode1: one row one table in sql
|
||||
print =============== insert data, mode1: mulit rows one table in sql
|
||||
#print =============== insert data, mode1: one rows mulit table in sql
|
||||
|
@ -41,9 +40,6 @@ sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
|
|||
sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
sql insert into ct2 values(now+0s, 10, 2.0, 3.0)
|
||||
sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
#sql insert into ct1 values(now+4s, -14, -2.4, -3.4) ct2 values(now+4s, -14, -2.4, -3.4)
|
||||
#sql insert into ct1 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6) ct2 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6)
|
||||
|
||||
sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
|
||||
|
||||
#===================================================================
|
||||
|
@ -67,16 +63,6 @@ endi
|
|||
if $data03 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
#if $data41 != -14 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data42 != -2.40000 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data43 != -3.400000000 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
|
||||
print =============== select count(*) from child table
|
||||
sql select count(*) from ct1
|
||||
|
@ -107,10 +93,10 @@ if $data03 != 4 then
|
|||
endi
|
||||
|
||||
#print =============== select first(*)/first(column) from child table
|
||||
#sql select first(*) from ct1
|
||||
#print ====> select first(*) from ct1
|
||||
#print rows: $rows
|
||||
#print $data00 $data01 $data02 $data03
|
||||
sql select first(*) from ct1
|
||||
print ====> select first(*) from ct1
|
||||
print rows: $rows
|
||||
print $data00 $data01 $data02 $data03
|
||||
|
||||
sql select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
print ====> select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
|
@ -217,23 +203,23 @@ if $data32 != -3.300000000 then
|
|||
return -1
|
||||
endi
|
||||
#===================================================================
|
||||
#===================================================================
|
||||
|
||||
#print =============== query data from stb
|
||||
#sql select * from stb
|
||||
#if $rows != 4 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from stb
|
||||
print $rows
|
||||
if $rows != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#print =============== select count(*) from supter table
|
||||
#sql select count(*) from stb
|
||||
#print $data00 $data01 $data02
|
||||
#if $rows != 1 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data00 != 9 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select count(*) from stb
|
||||
print $data00 $data01 $data02
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== select count(column) from supter table
|
||||
sql select ts, c1, c2, c3 from stb
|
||||
|
@ -264,28 +250,23 @@ if $data03 != 3.000000000 then
|
|||
endi
|
||||
|
||||
#print =============== select count(column) from supter table
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
#print rows: $rows
|
||||
#print $data00 $data01 $data02 $data03
|
||||
#print $data10 $data11 $data12 $data13
|
||||
#print $data20 $data21 $data22 $data23
|
||||
#print $data30 $data31 $data32 $data33
|
||||
#if $data00 != 9 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data01 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data02 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data03 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
print rows: $rows
|
||||
print $data00 $data01 $data02 $data03
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#===================================================================
|
||||
#===================================================================
|
||||
|
||||
print =============== stop and restart taosd, then again do query above
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
@ -326,16 +307,6 @@ endi
|
|||
if $data03 != 3.000000000 then
|
||||
return -1
|
||||
endi
|
||||
#if $data41 != -14 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data42 != -2.40000 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data43 != -3.400000000 then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
|
||||
print =============== select count(*) from child table
|
||||
sql select count(*) from ct1
|
||||
|
@ -366,10 +337,10 @@ if $data03 != 4 then
|
|||
endi
|
||||
|
||||
#print =============== select first(*)/first(column) from child table
|
||||
#sql select first(*) from ct1
|
||||
#print ====> select first(*) from ct1
|
||||
#print rows: $rows
|
||||
#print $data00 $data01 $data02 $data03
|
||||
sql select first(*) from ct1
|
||||
print ====> select first(*) from ct1
|
||||
print rows: $rows
|
||||
print $data00 $data01 $data02 $data03
|
||||
|
||||
sql select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
print ====> select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
|
@ -474,24 +445,23 @@ endi
|
|||
if $data32 != -3.300000000 then
|
||||
return -1
|
||||
endi
|
||||
#===================================================================
|
||||
#===================================================================
|
||||
|
||||
#print =============== query data from stb
|
||||
#sql select * from stb
|
||||
#if $rows != 4 then
|
||||
# return -1
|
||||
#endi
|
||||
#===================================================================
|
||||
print =============== query data from stb
|
||||
sql select * from stb
|
||||
if $rows != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#print =============== select count(*) from supter table
|
||||
#sql select count(*) from stb
|
||||
#print $data00 $data01 $data02
|
||||
#if $rows != 1 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data00 != 9 then
|
||||
# return -1
|
||||
#endi
|
||||
print =============== select count(*) from supter table
|
||||
sql select count(*) from stb
|
||||
print $data00 $data01 $data02
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== select count(column) from supter table
|
||||
sql select ts, c1, c2, c3 from stb
|
||||
|
@ -521,20 +491,19 @@ if $data03 != 3.000000000 then
|
|||
endi
|
||||
|
||||
#print =============== select count(column) from supter table
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
#print $data00 $data01 $data02 $data03
|
||||
#if $data00 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data01 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data02 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
#if $data03 != 8 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
print $data00 $data01 $data02 $data03
|
||||
if $data00 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 9 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 9 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -1,9 +1,7 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 50
|
||||
sql connect
|
||||
|
||||
print =============== create database
|
||||
sql create database d1
|
||||
sql show databases
|
||||
|
@ -17,7 +15,6 @@ sql use d1
|
|||
|
||||
print =============== create super table, include all type
|
||||
sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned)
|
||||
|
||||
sql create stable if not exists stb_1 (ts timestamp, i int) tags (j int)
|
||||
sql create table stb_2 (ts timestamp, i int) tags (j int)
|
||||
sql create stable stb_3 (ts timestamp, i int) tags (j int)
|
||||
|
@ -36,11 +33,6 @@ if $rows != 2 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print =============== insert data, mode1: one row one table in sql
|
||||
print =============== insert data, mode1: mulit rows one table in sql
|
||||
print =============== insert data, mode1: one rows mulit table in sql
|
||||
print =============== insert data, mode1: mulit rows mulit table in sql
|
||||
sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
|
||||
|
@ -69,32 +61,15 @@ if $data03 != -2 then
|
|||
endi
|
||||
|
||||
print =============== query data from st, but not support select * from super table, waiting fix
|
||||
#sql select * from st
|
||||
#if $rows != 4 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from stb
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== stop and restart taosd
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
$loop_cnt = 0
|
||||
check_dnode_ready:
|
||||
$loop_cnt = $loop_cnt + 1
|
||||
sleep 200
|
||||
if $loop_cnt == 10 then
|
||||
print ====> dnode not ready!
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes
|
||||
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
|
||||
if $data00 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != ready then
|
||||
goto check_dnode_ready
|
||||
endi
|
||||
|
||||
print =============== query data
|
||||
sql select * from c1
|
||||
print rows: $rows
|
||||
|
@ -119,9 +94,9 @@ if $data03 != -2 then
|
|||
endi
|
||||
|
||||
print =============== query data from st, but not support select * from super table, waiting fix
|
||||
#sql select * from st
|
||||
#if $rows != 4 then
|
||||
# return -1
|
||||
#endi
|
||||
sql select * from stb
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -17,10 +17,10 @@ sql use test
|
|||
sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
|
||||
sql create table t1 using st tags(1,1,1);
|
||||
sql create table t2 using st tags(2,2,2);
|
||||
sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s);
|
||||
sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s);
|
||||
sql create stream stream_t1 trigger at_once into streamtST as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s);
|
||||
sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstartts, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s);
|
||||
sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s);
|
||||
sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s);
|
||||
sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s);
|
||||
sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s);
|
||||
|
||||
sql insert into t1 values(1648791210000,1,2,3,1.0);
|
||||
sql insert into t1 values(1648791216000,2,2,3,1.1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/cfg.sh -n dnode1 -c debugflag -v 131
|
||||
system sh/exec.sh -n dnode1 -s start -v
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print =============== step1: create drop show dnodes
|
||||
|
@ -23,51 +23,65 @@ if $data(1)[4] != ready then
|
|||
endi
|
||||
|
||||
print =============== step2: create db
|
||||
sql create database d1 vgroups 1 buffer 3
|
||||
sql create database d1 vgroups 3 buffer 3
|
||||
sql show databases
|
||||
sql use d1
|
||||
sql show vgroups
|
||||
|
||||
print =============== step3: create show stable
|
||||
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||
print =============== step3: create show stable, include all type
|
||||
sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned)
|
||||
sql create stable if not exists stb_1 (ts timestamp, c1 int) tags (j int)
|
||||
sql create table stb_2 (ts timestamp, c1 int) tags (t1 int)
|
||||
sql create stable stb_3 (ts timestamp, c1 int) tags (t1 int)
|
||||
sql show stables
|
||||
if $rows != 1 then
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step4: create show table
|
||||
sql create table ct1 using stb tags(1000)
|
||||
sql create table ct2 using stb tags(2000)
|
||||
sql create table ct3 using stb tags(3000)
|
||||
print =============== step4: ccreate child table
|
||||
sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql show tables
|
||||
if $rows != 3 then
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step5: insert data
|
||||
sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
|
||||
sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
sql insert into ct2 values(now+0s, 10, 2.0, 3.0)
|
||||
sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
|
||||
sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql insert into c2 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql insert into c2 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
|
||||
print =============== step6: query data
|
||||
sql select * from ct1
|
||||
sql select * from stb
|
||||
sql select c1, c2, c3 from ct1
|
||||
sql select ts, c1, c2, c3 from stb
|
||||
print =============== step6: alter insert
|
||||
sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
|
||||
|
||||
print =============== step7: count
|
||||
sql select count(*) from ct1;
|
||||
print =============== restart
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s start -v
|
||||
|
||||
print =============== stepa: query data
|
||||
sql select * from c1
|
||||
#sql select * from stb
|
||||
#sql select * from stb_1
|
||||
#sql select ts, c1, c2, c3 from c1
|
||||
#sql select ts, c1, c2, c3 from stb
|
||||
#sql select ts, c1 from stb_2
|
||||
#sql select ts, c1, t1 from c1
|
||||
#sql select ts, c1, t1 from stb
|
||||
#sql select ts, c1, t1 from stb_2
|
||||
|
||||
print =============== stepb: count
|
||||
#sql select count(*) from c1;
|
||||
#sql select count(*) from stb;
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from ct1
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from c1
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
|
||||
print =============== step8: func
|
||||
#sql select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
#sql select min(c1), min(c2), min(c3) from ct1
|
||||
#sql select max(c1), max(c2), max(c3) from ct1
|
||||
#sql select sum(c1), sum(c2), sum(c3) from ct1
|
||||
print =============== stepc: func
|
||||
#sql select first(ts), first(c1), first(c2), first(c3) from c1
|
||||
#sql select min(c2), min(c3), min(c4) from c1
|
||||
#sql select max(c2), max(c3), max(c4) from c1
|
||||
#sql select sum(c2), sum(c3), sum(c4) from c1
|
||||
|
||||
_OVER:
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -37,22 +37,40 @@ endi
|
|||
|
||||
print =============== step4: create show table
|
||||
sql create table ct1 using stb tags(1000)
|
||||
sql create table ct2 using stb tags(2000)
|
||||
sql create table ct3 using stb tags(3000)
|
||||
sql show tables
|
||||
if $rows != 1 then
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step5: insert data
|
||||
sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
|
||||
sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
sql insert into ct2 values(now+0s, 10, 2.0, 3.0)
|
||||
sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
|
||||
sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
|
||||
|
||||
print =============== step6: select data
|
||||
print =============== step6: query data
|
||||
sql select * from ct1
|
||||
sql select * from stb
|
||||
sql select c1, c2, c3 from ct1
|
||||
sql select ts, c1, c2, c3 from stb
|
||||
|
||||
print =============== step7: count
|
||||
sql select count(*) from ct1;
|
||||
sql select count(*) from stb;
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from ct1
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
|
||||
print =============== step8: func
|
||||
sql select first(ts), first(c1), first(c2), first(c3) from ct1
|
||||
sql select min(c1), min(c2), min(c3) from ct1
|
||||
sql select max(c1), max(c2), max(c3) from ct1
|
||||
sql select sum(c1), sum(c2), sum(c3) from ct1
|
||||
|
||||
_OVER:
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
print =============== check
|
||||
$null=
|
||||
|
||||
|
|
|
@ -68,16 +68,16 @@ sql select ts, c1, t1 from stb
|
|||
sql select ts, c1, t1 from stb_2
|
||||
|
||||
print =============== stepb: count
|
||||
#sql select count(*) from c1;
|
||||
#sql select count(*) from stb;
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from c1
|
||||
#sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
sql select count(*) from c1;
|
||||
sql select count(*) from stb;
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from c1
|
||||
sql select count(ts), count(c1), count(c2), count(c3) from stb
|
||||
|
||||
print =============== stepc: func
|
||||
#sql select first(ts), first(c1), first(c2), first(c3) from c1
|
||||
#sql select min(c1), min(c2), min(c3) from c1
|
||||
#sql select max(c1), max(c2), max(c3) from c1
|
||||
#sql select sum(c1), sum(c2), sum(c3) from c1
|
||||
sql select first(ts), first(c1), first(c2), first(c3) from c1
|
||||
sql select min(c2), min(c3), min(c4) from c1
|
||||
sql select max(c2), max(c3), max(c4) from c1
|
||||
sql select sum(c2), sum(c3), sum(c4) from c1
|
||||
|
||||
_OVER:
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3f42d428eb6b90dea2651f4ccea66e44705c831b
|
||||
Subproject commit bd496f76b64931c66da2f8b0f24143a98a881cde
|
|
@ -1 +1 @@
|
|||
Subproject commit c885e967e490105999b84d009a15168728dfafaf
|
||||
Subproject commit df8678f070e3f707faf59baebec90065f6e1268b
|
Loading…
Reference in New Issue