提交 39fb5651 编写于 作者: D dapan1121

Merge branch 'feature/qnode' of github.com:taosdata/TDengine into feature/qnode

......@@ -400,7 +400,7 @@ TEST(testCase, show_vgroup_Test) {
taos_free_result(pRes);
taos_close(pConn);
}
#endif
TEST(testCase, create_multiple_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
......@@ -653,6 +653,7 @@ TEST(testCase, projection_query_stables) {
taos_free_result(pRes);
taos_close(pConn);
}
#endif
TEST(testCase, agg_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
......@@ -661,7 +662,7 @@ TEST(testCase, agg_query_tables) {
TAOS_RES* pRes = taos_query(pConn, "use abc1");
taos_free_result(pRes);
pRes = taos_query(pConn, "select count(*) from tu");
pRes = taos_query(pConn, "select length('abc') from tu");
if (taos_errno(pRes) != 0) {
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
taos_free_result(pRes);
......
......@@ -2071,7 +2071,7 @@ int32_t tDeserializeSUseDbBatchRsp(void *buf, int32_t bufLen, SUseDbBatchRsp *pR
int32_t numOfBatch = taosArrayGetSize(pRsp->pArray);
if (tDecodeI32(&decoder, &numOfBatch) < 0) return -1;
pRsp->pArray = taosArrayInit(numOfBatch, sizeof(SUseDbBatchRsp));
pRsp->pArray = taosArrayInit(numOfBatch, sizeof(SUseDbRsp));
if (pRsp->pArray == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
......
......@@ -158,7 +158,7 @@ SMgmtWrapper *dndAcquireWrapper(SDnode *pDnode, EDndType ntype) {
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
dTrace("node:%s, is acquired, refCount:%d", pWrapper->name, refCount);
} else {
terrno = TSDB_CODE_NODE_REDIRECT;
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
pRetWrapper = NULL;
}
taosRUnLockLatch(&pWrapper->latch);
......@@ -174,7 +174,7 @@ int32_t dndMarkWrapper(SMgmtWrapper *pWrapper) {
int32_t refCount = atomic_add_fetch_32(&pWrapper->refCount, 1);
dTrace("node:%s, is marked, refCount:%d", pWrapper->name, refCount);
} else {
terrno = TSDB_CODE_NODE_REDIRECT;
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
code = -1;
}
taosRUnLockLatch(&pWrapper->latch);
......
......@@ -53,8 +53,9 @@ static void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpS
int32_t code = -1;
SNodeMsg *pMsg = NULL;
NodeMsgFp msgFp = NULL;
uint16_t msgType = pRpc->msgType;
if (pEpSet && pEpSet->numOfEps > 0 && pRpc->msgType == TDMT_MND_STATUS_RSP) {
if (pEpSet && pEpSet->numOfEps > 0 && msgType == TDMT_MND_STATUS_RSP) {
dndUpdateMnodeEpSet(pWrapper->pDnode, pEpSet);
}
......@@ -84,9 +85,15 @@ _OVER:
}
} else {
dError("msg:%p, failed to process since 0x%04x:%s", pMsg, code & 0XFFFF, terrstr());
if (pRpc->msgType & 1U) {
if (msgType & 1U) {
if (terrno != 0) code = terrno;
SRpcMsg rsp = {.handle = pRpc->handle, .ahandle = pRpc->ahandle, .code = terrno};
if (code == TSDB_CODE_NODE_NOT_DEPLOYED || code == TSDB_CODE_NODE_OFFLINE) {
if (msgType > TDMT_MND_MSG && msgType < TDMT_VND_MSG) {
code = TSDB_CODE_NODE_REDIRECT;
}
}
SRpcMsg rsp = {.handle = pRpc->handle, .ahandle = pRpc->ahandle, .code = code};
tmsgSendRsp(&rsp);
}
dTrace("msg:%p, is freed", pMsg);
......@@ -348,8 +355,7 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p
}
static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
if (pRsp->code == TSDB_CODE_APP_NOT_READY || pRsp->code == TSDB_CODE_NODE_REDIRECT ||
pRsp->code == TSDB_CODE_NODE_OFFLINE) {
if (pRsp->code == TSDB_CODE_NODE_REDIRECT) {
dmSendRedirectRsp(pWrapper->pMgmt, pRsp);
} else {
rpcSendResponse(pRsp);
......@@ -442,7 +448,8 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t
static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen,
ProcFuncType ftype) {
pMsg->pCont = pCont;
dTrace("msg:%p, get from parent queue, ftype:%d handle:%p, app:%p", pMsg, ftype, pMsg->handle, pMsg->ahandle);
dTrace("msg:%p, get from parent queue, ftype:%d handle:%p code:0x%04x mtype:%d, app:%p", pMsg, ftype, pMsg->handle,
pMsg->code & 0xFFFF, pMsg->msgType, pMsg->ahandle);
switch (ftype) {
case PROC_REGIST:
......
......@@ -96,7 +96,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
if (alterReq.dnodeId != pDnode->dnodeId) {
terrno = TSDB_CODE_INVALID_OPTION;
dError("failed to alter mnode since %s", terrstr());
dError("failed to alter mnode since %s, dnodeId:%d input:%d", terrstr(), pDnode->dnodeId, alterReq.dnodeId);
return -1;
} else {
return mmAlter(pMgmt, &alterReq);
......
......@@ -112,6 +112,9 @@ static int32_t mmOpenImp(SMnodeMgmt *pMgmt, SDCreateMnodeReq *pReq) {
if (!deployed) {
dInfo("mnode start to deploy");
if (pMgmt->pWrapper->procType == PROC_CHILD) {
pMgmt->pDnode->dnodeId = 1;
}
mmBuildOptionForDeploy(pMgmt, &option);
} else {
dInfo("mnode start to open");
......
......@@ -188,7 +188,7 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_REDIRECT);
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
}
{
......
......@@ -609,6 +609,12 @@ typedef struct SSessionAggOperatorInfo {
SColumnInfoData timeWindowData; // query time window info for scalar function execution.
} SSessionAggOperatorInfo;
typedef struct STimeSliceOperatorInfo {
SOptrBasicInfo binfo;
SInterval interval;
SGroupResInfo groupResInfo; // multiple results build supporter
} STimeSliceOperatorInfo;
typedef struct SStateWindowOperatorInfo {
SOptrBasicInfo binfo;
SAggSupporter aggSup;
......@@ -665,7 +671,7 @@ int32_t operatorDummyOpenFn(SOperatorInfo* pOperator);
void operatorDummyCloseFn(void* param, int32_t numOfCols);
int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num);
int32_t initAggInfo(SOptrBasicInfo* pBasicInfo, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols,
int32_t numOfRows, SSDataBlock* pResultBlock, const char* pkey);
int32_t numOfRows, SSDataBlock* pResultBlock, size_t keyBufSize, const char* pkey);
void toSDatablock(SGroupResInfo* pGroupResInfo, SDiskbasedBuf* pBuf, SSDataBlock* pBlock, int32_t rowCapacity, int32_t* rowCellOffset);
void finalizeMultiTupleQueryResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset);
void doApplyFunctions(SqlFunctionCtx* pCtx, STimeWindow* pWin, SColumnInfoData* pTimeWindowData, int32_t offset, int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput, int32_t order);
......@@ -707,16 +713,15 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInf
SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SArray* pGroupColList,
SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo);
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo);
#if 0
SOperatorInfo* createTableSeqScanOperatorInfo(void* pTsdbReadHandle, STaskRuntimeEnv* pRuntimeEnv);
SOperatorInfo* createAllTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream,
SExprInfo* pExpr, int32_t numOfOutput);
SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream,
SExprInfo* pExpr, int32_t numOfOutput);
SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream,
SExprInfo* pExpr, int32_t numOfOutput);
SOperatorInfo* createTagScanOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput);
SOperatorInfo* createTagScanOperatorInfo(SReaderHandle* pReaderHandle, SExprInfo* pExpr, int32_t numOfOutput);
SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pdownstream, int32_t numOfDownstream, SSchema* pSchema,
int32_t numOfOutput);
......
......@@ -1687,12 +1687,13 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSessionAggOperator
static void setResultRowKey(SResultRow* pResultRow, char* pData, int16_t type) {
if (IS_VAR_DATA_TYPE(type)) {
if (pResultRow->key == NULL) {
pResultRow->key = taosMemoryMalloc(varDataTLen(pData));
varDataCopy(pResultRow->key, pData);
} else {
assert(memcmp(pResultRow->key, pData, varDataTLen(pData)) == 0);
}
// todo disable this
// if (pResultRow->key == NULL) {
// pResultRow->key = taosMemoryMalloc(varDataTLen(pData));
// varDataCopy(pResultRow->key, pData);
// } else {
// ASSERT(memcmp(pResultRow->key, pData, varDataTLen(pData)) == 0);
// }
} else {
int64_t v = -1;
GET_TYPED_DATA(v, int64_t, type, pData);
......@@ -4467,7 +4468,7 @@ SSDataBlock* createResultDataBlock(const SArray* pExprInfo) {
return pResBlock;
}
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, const char* pKey);
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize, const char* pKey);
static void cleanupAggSup(SAggSupporter* pAggSup);
static void destroySortedMergeOperatorInfo(void* param, int32_t numOfOutput) {
......@@ -4826,7 +4827,8 @@ SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t
goto _error;
}
int32_t code = doInitAggInfoSup(&pInfo->aggSup, pInfo->binfo.pCtx, num, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
int32_t code = doInitAggInfoSup(&pInfo->aggSup, pInfo->binfo.pCtx, num, keyBufSize, pTaskInfo->id.str);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
......@@ -5429,58 +5431,48 @@ static SSDataBlock* doAllIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) {
return NULL;
}
STableIntervalOperatorInfo* pIntervalInfo = pOperator->info;
STaskRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv;
STimeSliceOperatorInfo* pSliceInfo = pOperator->info;
if (pOperator->status == OP_RES_TO_RETURN) {
// toSDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
if (pIntervalInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
if (pSliceInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pSliceInfo->groupResInfo)) {
doSetOperatorCompleted(pOperator);
}
return pIntervalInfo->binfo.pRes;
return pSliceInfo->binfo.pRes;
}
STaskAttr* pQueryAttr = pRuntimeEnv->pQueryAttr;
int32_t order = pQueryAttr->order.order;
STimeWindow win = pQueryAttr->window;
int32_t order = TSDB_ORDER_ASC;
// STimeWindow win = pQueryAttr->window;
SOperatorInfo* downstream = pOperator->pDownstream[0];
while (1) {
publishOperatorProfEvent(downstream, QUERY_PROF_BEFORE_OPERATOR_EXEC);
SSDataBlock* pBlock = downstream->getNextFn(downstream, newgroup);
publishOperatorProfEvent(downstream, QUERY_PROF_AFTER_OPERATOR_EXEC);
if (pBlock == NULL) {
break;
}
// setTagValue(pOperator, pRuntimeEnv->current->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput);
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pIntervalInfo->binfo.pCtx, pBlock, pQueryAttr->order.order);
hashAllIntervalAgg(pOperator, &pIntervalInfo->binfo.resultRowInfo, pBlock, 0);
setInputDataBlock(pOperator, pSliceInfo->binfo.pCtx, pBlock, order);
hashAllIntervalAgg(pOperator, &pSliceInfo->binfo.resultRowInfo, pBlock, 0);
}
// restore the value
pQueryAttr->order.order = order;
pQueryAttr->window = win;
pOperator->status = OP_RES_TO_RETURN;
closeAllResultRows(&pIntervalInfo->binfo.resultRowInfo);
closeAllResultRows(&pSliceInfo->binfo.resultRowInfo);
setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED);
finalizeQueryResult(pIntervalInfo->binfo.pCtx, pOperator->numOfOutput);
finalizeQueryResult(pSliceInfo->binfo.pCtx, pOperator->numOfOutput);
initGroupResInfo(&pRuntimeEnv->groupResInfo, &pIntervalInfo->binfo.resultRowInfo);
// toSDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
initGroupResInfo(&pSliceInfo->groupResInfo, &pSliceInfo->binfo.resultRowInfo);
// toSDatablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pSliceInfo->pRes);
if (pIntervalInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) {
if (pSliceInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pSliceInfo->groupResInfo)) {
pOperator->status = OP_EXEC_DONE;
}
return pIntervalInfo->binfo.pRes->info.rows == 0 ? NULL : pIntervalInfo->binfo.pRes;
return pSliceInfo->binfo.pRes->info.rows == 0 ? NULL : pSliceInfo->binfo.pRes;
}
static SSDataBlock* doSTableIntervalAgg(SOperatorInfo* pOperator, bool* newgroup) {
......@@ -5900,11 +5892,11 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) {
taosMemoryFreeClear(pOperator);
}
int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, const char* pKey) {
int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize, const char* pKey) {
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
pAggSup->keyBuf = taosMemoryCalloc(1, sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES);
pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize);
pAggSup->pResultRowHashTable = taosHashInit(10, hashFn, true, HASH_NO_LOCK);
pAggSup->pResultRowListSet = taosHashInit(100, hashFn, false, HASH_NO_LOCK);
pAggSup->pResultRowArrayList = taosArrayInit(10, sizeof(SResultRowCell));
......@@ -5931,12 +5923,12 @@ static void cleanupAggSup(SAggSupporter* pAggSup) {
}
int32_t initAggInfo(SOptrBasicInfo* pBasicInfo, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols,
int32_t numOfRows, SSDataBlock* pResultBlock, const char* pkey) {
int32_t numOfRows, SSDataBlock* pResultBlock, size_t keyBufSize, const char* pkey) {
pBasicInfo->pCtx = createSqlFunctionCtx_rv(pExprInfo, numOfCols, &pBasicInfo->rowCellInfoOffset);
pBasicInfo->pRes = pResultBlock;
pBasicInfo->capacity = numOfRows;
doInitAggInfoSup(pAggSup, pBasicInfo->pCtx, numOfCols, pkey);
doInitAggInfoSup(pAggSup, pBasicInfo->pCtx, numOfCols, keyBufSize, pkey);
return TSDB_CODE_SUCCESS;
}
......@@ -5975,7 +5967,8 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo*
//(int32_t)(getRowNumForMultioutput(pQueryAttr, pQueryAttr->topBotQuery, pQueryAttr->stableQuery));
int32_t numOfRows = 1;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResultBlock, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResultBlock, keyBufSize, pTaskInfo->id.str);
pInfo->pTableQueryInfo = initTableQueryInfo(pTableGroupInfo);
if (code != TSDB_CODE_SUCCESS || pInfo->pTableQueryInfo == NULL) {
goto _error;
......@@ -6091,8 +6084,9 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SOperatorInfo* downstream, SExprI
SAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAggOperatorInfo));
int32_t numOfRows = 1;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
int32_t code =
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, pTaskInfo->id.str);
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, keyBufSize, pTaskInfo->id.str);
pInfo->pTableQueryInfo = initTableQueryInfo(pTableGroupInfo);
if (code != TSDB_CODE_SUCCESS || pInfo->pTableQueryInfo == NULL) {
goto _error;
......@@ -6152,7 +6146,8 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SExprInfo* p
int32_t numOfCols = num;
int32_t numOfRows = 4096;
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, keyBufSize, pTaskInfo->id.str);
setFunctionResultOutput(&pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, pTaskInfo);
pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pInfo->binfo.pCtx, numOfCols);
......@@ -6200,7 +6195,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pInfo->primaryTsIndex = primaryTsSlot;
int32_t numOfRows = 4096;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, keyBufSize, pTaskInfo->id.str);
initExecTimeWindowInfo(&pInfo->timeWindowData, &pInfo->win);
// pInfo->pTableQueryInfo = initTableQueryInfo(pTableGroupInfo);
......@@ -6238,28 +6234,34 @@ _error:
return NULL;
}
SOperatorInfo* createAllTimeIntervalOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorInfo* downstream,
SExprInfo* pExpr, int32_t numOfOutput) {
STableIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STableIntervalOperatorInfo));
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo) {
STimeSliceOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STimeSliceOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pOperator == NULL || pInfo == NULL) {
goto _error;
}
// pInfo->binfo.pCtx = createSqlFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset);
// pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, pResultInfo->capacity);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8);
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
pOperator->name = "AllTimeIntervalAggOperator";
pOperator->name = "TimeSliceOperator";
// pOperator->operatorType = OP_AllTimeWindow;
pOperator->blockingOptr = true;
pOperator->status = OP_NOT_OPENED;
pOperator->pExpr = pExpr;
pOperator->numOfOutput = numOfOutput;
pOperator->info = pInfo;
pOperator->getNextFn = doAllIntervalAgg;
pOperator->closeFn = destroyBasicOperatorInfo;
pOperator->status = OP_NOT_OPENED;
pOperator->pExpr = pExprInfo;
pOperator->numOfOutput = numOfCols;
pOperator->info = pInfo;
pOperator->pTaskInfo = pTaskInfo;
pOperator->getNextFn = doAllIntervalAgg;
pOperator->closeFn = destroyBasicOperatorInfo;
int32_t code = appendDownstream(pOperator, &downstream, 1);
return pOperator;
_error:
taosMemoryFree(pInfo);
taosMemoryFree(pOperator);
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo) {
......@@ -6270,8 +6272,8 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInf
}
pInfo->colIndex = -1;
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExpr, numOfCols, 4096, pResBlock, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExpr, numOfCols, 4096, pResBlock, keyBufSize, pTaskInfo->id.str);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8);
pOperator->name = "StateWindowOperator";
......@@ -6303,7 +6305,8 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo
}
int32_t numOfRows = 4096;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, pTaskInfo->id.str);
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
int32_t code = initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, numOfRows, pResBlock, keyBufSize, pTaskInfo->id.str);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
......
......@@ -46,7 +46,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
int32_t numOfGroupCols = taosArrayGetSize(pGroupColList);
for (int32_t i = 0; i < numOfGroupCols; ++i) {
SColumn* pCol = taosArrayGet(pGroupColList, i);
(*keyLen) += pCol->bytes;
(*keyLen) += pCol->bytes; // actual data + null_flag
SGroupKeys key = {0};
key.bytes = pCol->bytes;
......@@ -61,8 +61,9 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
}
int32_t nullFlagSize = sizeof(int8_t) * numOfGroupCols;
(*keyLen) += nullFlagSize;
(*keyBuf) = taosMemoryCalloc(1, (*keyLen) + nullFlagSize);
(*keyBuf) = taosMemoryCalloc(1, (*keyLen));
if ((*keyBuf) == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
......@@ -169,11 +170,16 @@ static void doAssignGroupKeys(SqlFunctionCtx* pCtx, int32_t numOfOutput, int32_t
SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(&pCtx[i]);
SColumnInfoData* pColInfoData = pCtx[i].input.pData[0];
// todo OPT all/all not NULL
if (!colDataIsNull(pColInfoData, totalRows, rowIndex, NULL)) {
char* dest = GET_ROWCELL_INTERBUF(pEntryInfo);
char* data = colDataGetData(pColInfoData, rowIndex);
memcpy(dest, data, pColInfoData->info.bytes);
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
varDataCopy(dest, data);
} else {
memcpy(dest, data, pColInfoData->info.bytes);
}
} else { // it is a NULL value
pEntryInfo->isNullRes = 1;
}
......@@ -326,14 +332,15 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
pInfo->pGroupCols = pGroupColList;
pInfo->pCondition = pCondition;
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, 4096, pResultBlock, pTaskInfo->id.str);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8);
int32_t code = initGroupOptrInfo(&pInfo->pGroupColVals, &pInfo->groupKeyLen, &pInfo->keyBuf, pGroupColList);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
initAggInfo(&pInfo->binfo, &pInfo->aggSup, pExprInfo, numOfCols, 4096, pResultBlock, pInfo->groupKeyLen, pTaskInfo->id.str);
initResultRowInfo(&pInfo->binfo.resultRowInfo, 8);
pOperator->name = "GroupbyAggOperator";
pOperator->blockingOptr = true;
pOperator->status = OP_NOT_OPENED;
......
......@@ -489,7 +489,7 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) {
int32_t paraType = pParam->node.resType.type;
int32_t resType = 0;
if (IS_SIGNED_NUMERIC_TYPE(paraType)) {
if (IS_SIGNED_NUMERIC_TYPE(paraType) || paraType == TSDB_DATA_TYPE_BOOL) {
resType = TSDB_DATA_TYPE_BIGINT;
} else if (IS_UNSIGNED_NUMERIC_TYPE(paraType)) {
resType = TSDB_DATA_TYPE_UBIGINT;
......
......@@ -138,8 +138,8 @@ int32_t sumFunction(SqlFunctionCtx *pCtx) {
int32_t start = pInput->startRowIndex;
int32_t numOfRows = pInput->numOfRows;
if (IS_SIGNED_NUMERIC_TYPE(type)) {
if (type == TSDB_DATA_TYPE_TINYINT) {
if (IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_BOOL) {
if (type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_BOOL) {
LIST_ADD_N(pSumRes->isum, pCol, start, numOfRows, int8_t, numOfElem);
} else if (type == TSDB_DATA_TYPE_SMALLINT) {
LIST_ADD_N(pSumRes->isum, pCol, start, numOfRows, int16_t, numOfElem);
......
......@@ -32,6 +32,8 @@
./test.sh -f tsim/query/interval-offset.sim
./test.sh -f tsim/query/scalarFunction.sim
./test.sh -f tsim/query/charScalarFunction.sim
./test.sh -f tsim/query/explain.sim
./test.sh -f tsim/query/session.sim
# ---- qnode
./test.sh -f tsim/qnode/basic1.sim
......@@ -43,7 +45,7 @@
./test.sh -f tsim/bnode/basic1.sim
# ---- mnode
./test.sh -f tsim/bnode/basic1.sim
./test.sh -f tsim/mnode/basic1.sim
# ---- show
./test.sh -f tsim/show/basic.sim
......@@ -69,7 +71,13 @@
# --- for multi process mode
./test.sh -f tsim/user/basic1.sim -m
./test.sh -f tsim/stable/vnode3.sim -m
./test.sh -f tsim/db/basic3.sim -m
./test.sh -f tsim/insert/backquote.sim
./test.sh -f tsim/parser/fourArithmetic-basic.sim -m
./test.sh -f tsim/query/interval-offset.sim -m
./test.sh -f tsim/tmq/basic.sim -m
./test.sh -f tsim/stable/vnode3.sim -m
./test.sh -f tsim/qnode/basic1.sim -m
./test.sh -f tsim/mnode/basic1.sim -m
#======================b1-end===============
......@@ -75,7 +75,6 @@ if $data02 != master then
return -1
endi
return
print =============== create drop mnode 1
sql_error create mnode on dnode 1
sql_error drop mnode on dnode 1
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
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
sql connect
print =============== create database
sql create database db
sql show databases
if $rows != 2 then
return -1
endi
sql use db
print =============== create super table and child table
sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int)
sql show stables
print $rows $data00 $data01 $data02
if $rows != 1 then
return -1
endi
sql create table ct1 using stb1 tags ( 1 )
sql create table ct2 using stb1 tags ( 2 )
sql create table ct3 using stb1 tags ( 3 )
sql create table ct4 using stb1 tags ( 4 )
sql show tables
print $rows $data00 $data10 $data20
if $rows != 4 then
return -1
endi
print =============== insert data into child table ct1 (s)
sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a )
sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a )
print =============== insert data into child table ct2 (d)
sql insert into ct2 values ( '2022-01-01 01:00:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct2 values ( '2022-01-01 10:00:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct2 values ( '2022-01-01 20:00:01.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct2 values ( '2022-01-02 10:00:01.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct2 values ( '2022-01-02 20:00:01.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct2 values ( '2022-01-03 10:00:01.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+6a )
sql insert into ct2 values ( '2022-01-03 20:00:01.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+7a )
print =============== insert data into child table ct3 (n)
sql insert into ct3 values ( '2021-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
sql insert into ct3 values ( '2021-12-31 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct3 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct3 values ( '2022-01-07 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct3 values ( '2022-01-31 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct3 values ( '2022-02-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct3 values ( '2022-02-28 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct3 values ( '2022-03-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct3 values ( '2022-03-08 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
print =============== insert data into child table ct4 (y)
sql insert into ct4 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct4 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct4 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct4 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct4 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct4 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct4 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
print ================ start query ======================
print ================ query 1 group by filter
sql select count(*) from ct3 group by c1
print ====> sql : select count(*) from ct3 group by c1
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c2
print ====> sql : select count(*) from ct3 group by c2
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c3
print ====> sql : select count(*) from ct3 group by c3
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c4
print ====> sql : select count(*) from ct3 group by c4
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c5
print ====> sql : select count(*) from ct3 group by c5
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c6
print ====> sql : select count(*) from ct3 group by c6
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c7
print ====> sql : select count(*) from ct3 group by c7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select count(*) from ct3 group by c8
print ====> sql : select count(*) from ct3 group by c8
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c9
print ====> sql : select count(*) from ct3 group by c9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c10
print ====> sql : select count(*) from ct3 group by c10
print ====> rows: $rows
if $rows != 8 then
return -1
endi
print ================ query 2 complex with group by
sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 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_0:
$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_0
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 then
return -1
endi
print ================ query 1 group by filter
sql select count(*) from ct3 group by c1
print ====> sql : select count(*) from ct3 group by c1
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c2
print ====> sql : select count(*) from ct3 group by c2
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c3
print ====> sql : select count(*) from ct3 group by c3
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c4
print ====> sql : select count(*) from ct3 group by c4
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c5
print ====> sql : select count(*) from ct3 group by c5
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c6
print ====> sql : select count(*) from ct3 group by c6
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c7
print ====> sql : select count(*) from ct3 group by c7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select count(*) from ct3 group by c8
print ====> sql : select count(*) from ct3 group by c8
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c9
print ====> sql : select count(*) from ct3 group by c9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c10
print ====> sql : select count(*) from ct3 group by c10
print ====> rows: $rows
if $rows != 8 then
return -1
endi
print ================ query 2 complex with group by
sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
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
sql connect
print =============== create database
sql create database db
sql show databases
if $rows != 2 then
return -1
endi
sql use db
print =============== create super table and child table
sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int)
sql show stables
print $rows $data00 $data01 $data02
if $rows != 1 then
return -1
endi
sql create table ct1 using stb1 tags ( 1 )
sql create table ct2 using stb1 tags ( 2 )
sql create table ct3 using stb1 tags ( 3 )
sql create table ct4 using stb1 tags ( 4 )
sql show tables
print $rows $data00 $data10 $data20
if $rows != 4 then
return -1
endi
print =============== insert data into child table ct1 (s)
sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a )
sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a )
print =============== insert data into child table ct2 (d)
sql insert into ct2 values ( '2022-01-01 01:00:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct2 values ( '2022-01-01 10:00:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct2 values ( '2022-01-01 20:00:01.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct2 values ( '2022-01-02 10:00:01.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct2 values ( '2022-01-02 20:00:01.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct2 values ( '2022-01-03 10:00:01.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+6a )
sql insert into ct2 values ( '2022-01-03 20:00:01.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+7a )
print =============== insert data into child table ct3 (n)
sql insert into ct3 values ( '2021-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
sql insert into ct3 values ( '2021-12-31 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct3 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct3 values ( '2022-01-07 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct3 values ( '2022-01-31 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct3 values ( '2022-02-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct3 values ( '2022-02-28 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct3 values ( '2022-03-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct3 values ( '2022-03-08 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
print =============== insert data into child table ct4 (y)
sql insert into ct4 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct4 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct4 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct4 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct4 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct4 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct4 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
print ================ start query ======================
print ================ query 1 limit/offset
sql select * from ct1 limit 1
print ====> sql : select * from ct1 limit 1
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
sql select * from ct1 limit 9
print ====> sql : select * from ct1 limit 9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct1 limit 1 offset 2
print ====> sql : select * from ct1 limit 1 offset 2
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
sql select * from ct1 limit 2 offset 1
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
if $data01 != 8 then
return -1
endi
sql select * from ct1 limit 2 offset 7
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data11 != 3 then
return -1
endi
sql select * from ct1 limit 2 offset 10
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 0 then
return -1
endi
sql select c1 from stb1 limit 1
print ====> sql : select c1 from stb1 limit 1
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 50
print ====> sql : select c1 from stb1 limit 50
print ====> rows: $rows
if $rows != 33 then
return -1
endi
sql select c1 from stb1 limit 1 offset 2
print ====> sql : select c1 from stb1 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 1
print ====> sql : select c1 from stb1 limit 2 offset 1
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select c1 from stb1 limit 2 offset 32
print ====> sql : select c1 from stb1 limit 2 offset 32
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 40
print ====> sql : select c1 from stb1 limit 2 offset 40
print ====> rows: $rows
if $rows != 0 then
return -1
endi
print ================ query 2 complex with limit
sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 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_0:
$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_0
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 then
return -1
endi
print ================ query 1 limit/offset
sql select * from ct1 limit 1
print ====> sql : select * from ct1 limit 1
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
sql select * from ct1 limit 9
print ====> sql : select * from ct1 limit 9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct1 limit 1 offset 2
print ====> sql : select * from ct1 limit 1 offset 2
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
sql select * from ct1 limit 2 offset 1
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
if $data01 != 8 then
return -1
endi
sql select * from ct1 limit 2 offset 7
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data11 != 3 then
return -1
endi
sql select * from ct1 limit 2 offset 10
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 0 then
return -1
endi
sql select c1 from stb1 limit 1
print ====> sql : select c1 from stb1 limit 1
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 50
print ====> sql : select c1 from stb1 limit 50
print ====> rows: $rows
if $rows != 33 then
return -1
endi
sql select c1 from stb1 limit 1 offset 2
print ====> sql : select c1 from stb1 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 1
print ====> sql : select c1 from stb1 limit 2 offset 1
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select c1 from stb1 limit 2 offset 32
print ====> sql : select c1 from stb1 limit 2 offset 32
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 40
print ====> sql : select c1 from stb1 limit 2 offset 40
print ====> rows: $rows
if $rows != 0 then
return -1
endi
print ================ query 2 complex with limit
sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
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
sql connect
print =============== create database
sql create database db
sql show databases
if $rows != 2 then
return -1
endi
sql use db
print =============== create super table and child table
sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int)
sql show stables
print $rows $data00 $data01 $data02
if $rows != 1 then
return -1
endi
sql create table ct1 using stb1 tags ( 1 )
sql create table ct2 using stb1 tags ( 2 )
sql create table ct3 using stb1 tags ( 3 )
sql create table ct4 using stb1 tags ( 4 )
sql show tables
print $rows $data00 $data10 $data20
if $rows != 4 then
return -1
endi
print =============== insert data into child table ct1 (s)
sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a )
sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a )
print =============== insert data into child table ct2 (d)
sql insert into ct2 values ( '2022-01-01 01:00:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct2 values ( '2022-01-01 10:00:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct2 values ( '2022-01-01 20:00:01.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct2 values ( '2022-01-02 10:00:01.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct2 values ( '2022-01-02 20:00:01.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct2 values ( '2022-01-03 10:00:01.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+6a )
sql insert into ct2 values ( '2022-01-03 20:00:01.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+7a )
print =============== insert data into child table ct3 (n)
sql insert into ct3 values ( '2021-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
sql insert into ct3 values ( '2021-12-31 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct3 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct3 values ( '2022-01-07 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct3 values ( '2022-01-31 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct3 values ( '2022-02-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct3 values ( '2022-02-28 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct3 values ( '2022-03-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct3 values ( '2022-03-08 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
print =============== insert data into child table ct4 (y)
sql insert into ct4 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a )
sql insert into ct4 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a )
sql insert into ct4 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a )
sql insert into ct4 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a )
sql insert into ct4 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a )
sql insert into ct4 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a )
sql insert into ct4 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
print ================ start query ======================
print ================ query 1 limit/offset
sql select * from ct1 limit 1
print ====> sql : select * from ct1 limit 1
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
sql select * from ct1 limit 9
print ====> sql : select * from ct1 limit 9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct1 limit 1 offset 2
print ====> sql : select * from ct1 limit 1 offset 2
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
sql select * from ct1 limit 2 offset 1
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
if $data01 != 8 then
return -1
endi
sql select * from ct1 limit 2 offset 7
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data11 != 3 then
return -1
endi
sql select * from ct1 limit 2 offset 10
print ====> sql : select * from ct1 limit 2 offset 7
print ====> rows: $rows
if $rows != 0 then
return -1
endi
sql select c1 from stb1 limit 1
print ====> sql : select c1 from stb1 limit 1
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 50
print ====> sql : select c1 from stb1 limit 50
print ====> rows: $rows
if $rows != 33 then
return -1
endi
sql select c1 from stb1 limit 1 offset 2
print ====> sql : select c1 from stb1 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 1
print ====> sql : select c1 from stb1 limit 2 offset 1
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select c1 from stb1 limit 2 offset 32
print ====> sql : select c1 from stb1 limit 2 offset 32
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select c1 from stb1 limit 2 offset 40
print ====> sql : select c1 from stb1 limit 2 offset 40
print ====> rows: $rows
if $rows != 0 then
return -1
endi
print ================ query 2 where condition
sql select * from ct3 where c1 < 5
print ====> sql : select * from ct3 where c1 < 5
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 4 then
return -1
endi
if $data01 != 1 then
return -1
endi
sql select * from ct3 where c1 > 5 and c1 <= 6
print ====> sql : select * from ct3 where c1 > 5 and c1 <= 6
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 1 then
return -1
endi
if $data01 != 6 then
return -1
endi
sql select * from ct3 where c1 >= 5 or c1 != 4 or c1 <> 3 or c1 = 2
print ====> sql : select * from ct3 where c1 > 5 and c1 <= 6
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 8 then
return -1
endi
if $data01 != 1 then
return -1
endi
sql select * from ct3 where c1 >= 5 and c1 is not NULL
print ====> sql : select * from ct3 where c1 >= 5 and c1 is not NULL
print ====> rows: $rows
print ====> rows0: $data00, $data01, $data02, $data03, $data04, $data05, $data06, $data07, $data08, $data09
if $rows != 4 then
return -1
endi
if $data01 != 5 then
return -1
endi
sql_error select ts from ct3 where ts != 0
sql select * from ct3 where ts <> 0
print ====> sql : select * from ct3 where ts <> 0
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct3 where c1 between 1 and 3
print ====> sql : select * from ct3 where c1 between 1 and 3
print ====> rows: $rows
if $rows != 3 then
return -1
endi
sql_error select * from ct3 where c7 between false and true
sql select * from ct3 where c1 in (1,2,3)
print ====> sql : select * from ct3 where c1 in (1,2,3)
print ====> rows: $rows
if $rows != 3 then
return -1
endi
sql select * from ct3 where c1 in (‘true','false')
print ====> sql : select * from ct3 where c1 in (‘true','false')
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct3 where c9 like "_char_"
print ====> sql : select * from ct3 where c1 in (1,2,3)
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select * from ct3 where c8 like "bi%"
print ====> sql : select * from ct3 where c1 in (1,2,3)
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select c1 from stb1 where c1 < 5
print ====> sql : select c1 from stb1 where c1 < 5
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 16 then
return -1
endi
if $data01 != 1 then
return -1
endi
sql select c1 from stb1 where stb1 > 5 and c1 <= 6
print ====> sql : select c1 from stb1 where c1 > 5 and c1 <= 6
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 4 then
return -1
endi
if $data01 != 6 then
return -1
endi
sql select c1 from stb1 where c1 >= 5 or c1 != 4 or c1 <> 3 or c1 = 2
print ====> sql : sselect c1 from stb1 where c1 >= 5 or c1 != 4 or c1 <> 3 or c1 = 2
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 32 then
return -1
endi
if $data01 != 1 then
return -1
endi
sql select c1 from stb1 where c1 >= 5 and c1 is not NULL
print ====> sql : select c1 from stb1 where c1 >= 5 and c1 is not NULL
print ====> rows: $rows
print ====> rows0: $data00
if $rows != 17 then
return -1
endi
if $data01 != 5 then
return -1
endi
sql_error select ts from stb1 where ts != 0
sql select c1 from stb1 where ts <> 0
print ====> sql : select c1 from stb1 where ts <> 0
print ====> rows: $rows
if $rows != 32 then
return -1
endi
sql select c1 from stb1 where c1 between 1 and 3
print ====> sql : select c1 from stb1 where c1 between 1 and 3
print ====> rows: $rows
if $rows != 12 then
return -1
endi
sql_error select c1 from stb1 where c7 between false and true
sql select c1 from stb1 where c1 in (1,2,3)
print ====> sql : select c1 from stb1 where c1 in (1,2,3)
print ====> rows: $rows
if $rows != 12 then
return -1
endi
sql select c1 from stb1 where c1 in (‘true','false')
print ====> sql : select c1 from stb1 where c1 in (‘true','false')
print ====> rows: $rows
if $rows != 32 then
return -1
endi
sql select c1 from stb1 where c9 like "_char_"
print ====> sql : select c1 from stb1 where c9 like "_char_"
print ====> rows: $rows
if $rows != 32 then
return -1
endi
sql select c1 from stb1 where c8 like "bi%"
print ====> sql : select c1 from stb1 where c8 like "bi%"
print ====> rows: $rows
if $rows != 32 then
return -1
endi
print ================ query 3 group by filter
sql select count(*) from ct3 group by c1
print ====> sql : select count(*) from ct3 group by c1
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c2
print ====> sql : select count(*) from ct3 group by c2
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c3
print ====> sql : select count(*) from ct3 group by c3
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c4
print ====> sql : select count(*) from ct3 group by c4
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c5
print ====> sql : select count(*) from ct3 group by c5
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c6
print ====> sql : select count(*) from ct3 group by c6
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c7
print ====> sql : select count(*) from ct3 group by c7
print ====> rows: $rows
if $rows != 2 then
return -1
endi
sql select count(*) from ct3 group by c8
print ====> sql : select count(*) from ct3 group by c8
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c9
print ====> sql : select count(*) from ct3 group by c9
print ====> rows: $rows
if $rows != 8 then
return -1
endi
sql select count(*) from ct3 group by c10
print ====> sql : select count(*) from ct3 group by c10
print ====> rows: $rows
if $rows != 8 then
return -1
endi
print ================ query 4 scalar function + where + group by + limit/offset
sql select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select count(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select abs(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select acos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select asin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select atan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select ceil(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select cos(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select floor(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select log(c1,10) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select pow(c1,3) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select round(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sqrt(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select sin(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
sql select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 1
print ====> sql : select tan(c1) from ct3 where c1 > 2 group by c7 limit 1 offset 2
print ====> rows: $rows
if $rows != 1 then
return -1
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 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_0:
$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_0
endi
print =================== count all rows
sql select count(c1) from stb1
print ====> sql : select count(c1) from stb1
print ====> rows: $data00
if $data00 != 33 then
return -1
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
此差异已折叠。
......@@ -77,6 +77,8 @@ sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.51', 7)
$loop_test = 0
loop_test_pos:
sql use $dbNamme
# session(ts,5a)
print ====> select count(*) from dev_001 session(ts,5a)
sql select _wstartts, count(*) from dev_001 session(ts,5a)
......@@ -98,15 +100,15 @@ if $data01 != 2 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,5a)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,5a)
if $rows != 15 then
return -1
endi
if $data01 != 2 then
return -1
endi
#
#print ====> select count(*) from (select * from dev_001) session(ts,5a)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,5a)
#if $rows != 15 then
# return -1
#endi
#if $data01 != 2 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1s)
sql select _wstartts, count(*) from dev_001 session(ts,1s)
......@@ -117,14 +119,14 @@ if $data01 != 5 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1s)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1s)
if $rows != 12 then
return -1
endi
if $data01 != 5 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1s)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1s)
#if $rows != 12 then
# return -1
#endi
#if $data01 != 5 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1000a)
sql select _wstartts, count(*) from dev_001 session(ts,1000a)
......@@ -135,14 +137,14 @@ if $data01 != 5 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1000a)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1000a)
if $rows != 12 then
return -1
endi
if $data01 != 5 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1000a)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1000a)
#if $rows != 12 then
# return -1
#endi
#if $data01 != 5 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1m)
sql select _wstartts, count(*) from dev_001 session(ts,1m)
......@@ -153,14 +155,14 @@ if $data01 != 8 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1m)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1m)
if $rows != 9 then
return -1
endi
if $data01 != 8 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1m)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1m)
#if $rows != 9 then
# return -1
#endi
#if $data01 != 8 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1h)
sql select _wstartts, count(*) from dev_001 session(ts,1h)
......@@ -171,14 +173,14 @@ if $data01 != 11 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1h)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1h)
if $rows != 6 then
return -1
endi
if $data01 != 11 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1h)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1h)
#if $rows != 6 then
# return -1
#endi
#if $data01 != 11 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1d)
sql select _wstartts, count(*) from dev_001 session(ts,1d)
......@@ -189,14 +191,14 @@ if $data01 != 13 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1d)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1d)
if $rows != 4 then
return -1
endi
if $data01 != 13 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1d)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1d)
#if $rows != 4 then
# return -1
#endi
#if $data01 != 13 then
# return -1
#endi
print ====> select count(*) from dev_001 session(ts,1w)
sql select _wstartts, count(*) from dev_001 session(ts,1w)
......@@ -207,18 +209,18 @@ if $data01 != 15 then
return -1
endi
print ====> select count(*) from (select * from dev_001) session(ts,1w)
sql select _wstartts, count(*) from (select * from dev_001) session(ts,1w)
if $rows != 2 then
return -1
endi
if $data01 != 15 then
return -1
endi
#print ====> select count(*) from (select * from dev_001) session(ts,1w)
#sql select _wstartts, count(*) from (select * from dev_001) session(ts,1w)
#if $rows != 2 then
# return -1
#endi
#if $data01 != 15 then
# return -1
#endi
print ====> leastsquares not supported yet.
print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)
#print ====> leastsquares not supported yet.
#print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)
#sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)
#if $rows != 2 then
# return -1
......@@ -285,14 +287,14 @@ print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtyp
#endi
print ================> syntax error check not active ================> reactive
#sql_error select * from dev_001 session(ts,1w)
#sql_error select count(*) from st session(ts,1w)
#sql_error select count(*) from dev_001 group by tagtype session(ts,1w)
#sql_error select count(*) from dev_001 session(ts,1n)
#sql_error select count(*) from dev_001 session(ts,1y)
#sql_error select count(*) from dev_001 session(ts,0s)
#sql_error select count(*) from dev_001 session(i,1y)
#sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'
sql_error select * from dev_001 session(ts,1w)
sql select count(*) from st session(ts,1w)
sql_error select count(*) from dev_001 group by tagtype session(ts,1w)
sql select count(*) from dev_001 session(ts,1n)
sql select count(*) from dev_001 session(ts,1y)
sql select count(*) from dev_001 session(ts,0s)
sql_error select count(*) from dev_001 session(i,1y)
sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'
print ====> create database d1 precision 'us'
sql create database d1 precision 'us'
......@@ -301,17 +303,22 @@ sql create table dev_001 (ts timestamp ,i timestamp ,j int)
sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)
print ====> select count(*) from dev_001 session(ts,1u)
sql select _wstartts, count(*) from dev_001 session(ts,1u)
if $rows != 2 then
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
print $data20 $data21 $data22 $data23
print $data30 $data31 $data32 $data33
if $rows != 4 then
print expect 2, actual: $rows
return -1
endi
if $data01 != 3 then
if $data01 != 1 then
return -1
endi
#sql_error select count(*) from dev_001 session(i,1s)
#sql create table secondts(ts timestamp,t2 timestamp,i int)
sql create table secondts(ts timestamp,t2 timestamp,i int)
#sql_error select count(*) from secondts session(t2,2s)
if $loop_test == 0 then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册