merge 3.0
This commit is contained in:
commit
a44d455e56
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG cb1e89c
|
GIT_TAG e02ddb2
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 149ac34
|
GIT_TAG 0681d8b
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -67,7 +67,7 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
|
static SClusterObj *mndAcquireCluster(SMnode *pMnode, void **ppIter) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
|
|
||||||
|
@ -76,23 +76,27 @@ static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
|
||||||
pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
|
pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
|
*ppIter = pIter;
|
||||||
|
|
||||||
return pCluster;
|
return pCluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mndReleaseCluster(SMnode *pMnode, SClusterObj *pCluster) {
|
static void mndReleaseCluster(SMnode *pMnode, SClusterObj *pCluster, void *pIter) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
sdbRelease(pSdb, pCluster);
|
sdbRelease(pSdb, pCluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t mndGetClusterId(SMnode *pMnode) {
|
int64_t mndGetClusterId(SMnode *pMnode) {
|
||||||
int64_t clusterId = 0;
|
int64_t clusterId = 0;
|
||||||
SClusterObj *pCluster = mndAcquireCluster(pMnode);
|
void *pIter = NULL;
|
||||||
|
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
|
||||||
if (pCluster != NULL) {
|
if (pCluster != NULL) {
|
||||||
clusterId = pCluster->id;
|
clusterId = pCluster->id;
|
||||||
mndReleaseCluster(pMnode, pCluster);
|
mndReleaseCluster(pMnode, pCluster, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return clusterId;
|
return clusterId;
|
||||||
|
@ -100,10 +104,11 @@ int64_t mndGetClusterId(SMnode *pMnode) {
|
||||||
|
|
||||||
int64_t mndGetClusterCreateTime(SMnode *pMnode) {
|
int64_t mndGetClusterCreateTime(SMnode *pMnode) {
|
||||||
int64_t createTime = 0;
|
int64_t createTime = 0;
|
||||||
SClusterObj *pCluster = mndAcquireCluster(pMnode);
|
void *pIter = NULL;
|
||||||
|
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
|
||||||
if (pCluster != NULL) {
|
if (pCluster != NULL) {
|
||||||
createTime = pCluster->createdTime;
|
createTime = pCluster->createdTime;
|
||||||
mndReleaseCluster(pMnode, pCluster);
|
mndReleaseCluster(pMnode, pCluster, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createTime;
|
return createTime;
|
||||||
|
@ -121,10 +126,11 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
|
||||||
|
|
||||||
float mndGetClusterUpTime(SMnode *pMnode) {
|
float mndGetClusterUpTime(SMnode *pMnode) {
|
||||||
int64_t upTime = 0;
|
int64_t upTime = 0;
|
||||||
SClusterObj *pCluster = mndAcquireCluster(pMnode);
|
void *pIter = NULL;
|
||||||
|
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
|
||||||
if (pCluster != NULL) {
|
if (pCluster != NULL) {
|
||||||
upTime = mndGetClusterUpTimeImp(pCluster);
|
upTime = mndGetClusterUpTimeImp(pCluster);
|
||||||
mndReleaseCluster(pMnode, pCluster);
|
mndReleaseCluster(pMnode, pCluster, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return upTime / 86400.0f;
|
return upTime / 86400.0f;
|
||||||
|
@ -321,11 +327,12 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) {
|
||||||
static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
|
static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
SClusterObj clusterObj = {0};
|
SClusterObj clusterObj = {0};
|
||||||
SClusterObj *pCluster = mndAcquireCluster(pMnode);
|
void *pIter = NULL;
|
||||||
|
SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
|
||||||
if (pCluster != NULL) {
|
if (pCluster != NULL) {
|
||||||
memcpy(&clusterObj, pCluster, sizeof(SClusterObj));
|
memcpy(&clusterObj, pCluster, sizeof(SClusterObj));
|
||||||
clusterObj.upTime += tsUptimeInterval;
|
clusterObj.upTime += tsUptimeInterval;
|
||||||
mndReleaseCluster(pMnode, pCluster);
|
mndReleaseCluster(pMnode, pCluster, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clusterObj.id <= 0) {
|
if (clusterObj.id <= 0) {
|
||||||
|
|
|
@ -35,7 +35,11 @@ _err:
|
||||||
static void tsdbCloseBICache(STsdb *pTsdb) {
|
static void tsdbCloseBICache(STsdb *pTsdb) {
|
||||||
SLRUCache *pCache = pTsdb->biCache;
|
SLRUCache *pCache = pTsdb->biCache;
|
||||||
if (pCache) {
|
if (pCache) {
|
||||||
|
int32_t elems = taosLRUCacheGetElems(pCache);
|
||||||
|
tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems);
|
||||||
taosLRUCacheEraseUnrefEntries(pCache);
|
taosLRUCacheEraseUnrefEntries(pCache);
|
||||||
|
elems = taosLRUCacheGetElems(pCache);
|
||||||
|
tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems);
|
||||||
|
|
||||||
taosLRUCacheCleanup(pCache);
|
taosLRUCacheCleanup(pCache);
|
||||||
|
|
||||||
|
@ -820,7 +824,12 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
||||||
* &state->blockIdx);
|
* &state->blockIdx);
|
||||||
*/
|
*/
|
||||||
state->pBlockIdx = taosArraySearch(state->aBlockIdx, state->pBlockIdxExp, tCmprBlockIdx, TD_EQ);
|
state->pBlockIdx = taosArraySearch(state->aBlockIdx, state->pBlockIdxExp, tCmprBlockIdx, TD_EQ);
|
||||||
if (!state->pBlockIdx) { /*
|
if (!state->pBlockIdx) {
|
||||||
|
tsdbBICacheRelease(state->pTsdb->biCache, state->aBlockIdxHandle);
|
||||||
|
|
||||||
|
state->aBlockIdxHandle = NULL;
|
||||||
|
state->aBlockIdx = NULL;
|
||||||
|
/*
|
||||||
tsdbDataFReaderClose(state->pDataFReader);
|
tsdbDataFReaderClose(state->pDataFReader);
|
||||||
*state->pDataFReader = NULL;
|
*state->pDataFReader = NULL;
|
||||||
resetLastBlockLoadInfo(state->pLoadInfo);*/
|
resetLastBlockLoadInfo(state->pLoadInfo);*/
|
||||||
|
@ -1937,6 +1946,7 @@ int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHa
|
||||||
taosThreadMutexUnlock(&pTsdb->biMutex);
|
taosThreadMutexUnlock(&pTsdb->biMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tsdbTrace("bi cache:%p, ref", pCache);
|
||||||
*handle = h;
|
*handle = h;
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -1946,6 +1956,7 @@ int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
taosLRUCacheRelease(pCache, h, false);
|
taosLRUCacheRelease(pCache, h, false);
|
||||||
|
tsdbTrace("bi cache:%p, release", pCache);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2320,7 +2320,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
|
|
||||||
tsdbRowMergerAdd(&merge, pRow, pSchema);
|
tsdbRowMergerAdd(&merge, pRow, pSchema);
|
||||||
} else {
|
} else {
|
||||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
// STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
|
||||||
code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
|
@ -2352,7 +2352,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
tsdbRowMergerAdd(&merge, piRow, piSchema);
|
tsdbRowMergerAdd(&merge, piRow, piSchema);
|
||||||
} else {
|
} else {
|
||||||
init = true;
|
init = true;
|
||||||
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
// STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
|
||||||
code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
|
code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -330,7 +330,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
|
||||||
qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64 ", uid:%" PRIu64,
|
qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64 ", uid:%" PRIu64,
|
||||||
GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows,
|
GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows,
|
||||||
pBlockInfo->id.uid);
|
pBlockInfo->id.uid);
|
||||||
doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
|
doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows);
|
||||||
pCost->skipBlocks += 1;
|
pCost->skipBlocks += 1;
|
||||||
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
|
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -341,7 +341,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
|
||||||
if (success) { // failed to load the block sma data, data block statistics does not exist, load data block instead
|
if (success) { // failed to load the block sma data, data block statistics does not exist, load data block instead
|
||||||
qDebug("%s data block SMA loaded, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64, GET_TASKID(pTaskInfo),
|
qDebug("%s data block SMA loaded, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64, GET_TASKID(pTaskInfo),
|
||||||
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
|
||||||
doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
|
doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows);
|
||||||
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
|
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -912,7 +912,8 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
|
||||||
SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc;
|
SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc;
|
||||||
|
|
||||||
int32_t numOfCols = 0;
|
int32_t numOfCols = 0;
|
||||||
code = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->base.matchInfo);
|
code =
|
||||||
|
extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->base.matchInfo);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
@ -1668,8 +1669,9 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
||||||
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||||
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
||||||
if (pResult && pResult->info.rows > 0) {
|
if (pResult && pResult->info.rows > 0) {
|
||||||
qDebug("queue scan tsdb return %"PRId64" rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows,
|
qDebug("queue scan tsdb return %" PRId64 " rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64,
|
||||||
pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion);
|
pResult->info.rows, pResult->info.window.skey, pResult->info.window.ekey,
|
||||||
|
pInfo->tqReader->pWalReader->curVersion);
|
||||||
tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pResult->info.id.uid, pResult->info.window.ekey);
|
tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pResult->info.id.uid, pResult->info.window.ekey);
|
||||||
return pResult;
|
return pResult;
|
||||||
}
|
}
|
||||||
|
@ -1687,14 +1689,18 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
||||||
while (1) {
|
while (1) {
|
||||||
SFetchRet ret = {0};
|
SFetchRet ret = {0};
|
||||||
tqNextBlock(pInfo->tqReader, &ret);
|
tqNextBlock(pInfo->tqReader, &ret);
|
||||||
tqOffsetResetToLog(&pTaskInfo->streamInfo.currentOffset, pInfo->tqReader->pWalReader->curVersion - 1); //curVersion move to next, so currentOffset = curVersion - 1
|
tqOffsetResetToLog(
|
||||||
|
&pTaskInfo->streamInfo.currentOffset,
|
||||||
|
pInfo->tqReader->pWalReader->curVersion - 1); // curVersion move to next, so currentOffset = curVersion - 1
|
||||||
|
|
||||||
if (ret.fetchType == FETCH_TYPE__DATA) {
|
if (ret.fetchType == FETCH_TYPE__DATA) {
|
||||||
qDebug("doQueueScan get data from log %"PRId64" rows, version:%" PRId64, ret.data.info.rows, pTaskInfo->streamInfo.currentOffset.version);
|
qDebug("doQueueScan get data from log %" PRId64 " rows, version:%" PRId64, ret.data.info.rows,
|
||||||
|
pTaskInfo->streamInfo.currentOffset.version);
|
||||||
blockDataCleanup(pInfo->pRes);
|
blockDataCleanup(pInfo->pRes);
|
||||||
setBlockIntoRes(pInfo, &ret.data, true);
|
setBlockIntoRes(pInfo, &ret.data, true);
|
||||||
if (pInfo->pRes->info.rows > 0) {
|
if (pInfo->pRes->info.rows > 0) {
|
||||||
qDebug("doQueueScan get data from log %"PRId64" rows, return, version:%" PRId64, pInfo->pRes->info.rows, pTaskInfo->streamInfo.currentOffset.version);
|
qDebug("doQueueScan get data from log %" PRId64 " rows, return, version:%" PRId64, pInfo->pRes->info.rows,
|
||||||
|
pTaskInfo->streamInfo.currentOffset.version);
|
||||||
return pInfo->pRes;
|
return pInfo->pRes;
|
||||||
}
|
}
|
||||||
} else if (ret.fetchType == FETCH_TYPE__NONE) {
|
} else if (ret.fetchType == FETCH_TYPE__NONE) {
|
||||||
|
|
|
@ -645,6 +645,10 @@ static bool isSelectStmt(SNode* pCurrStmt) {
|
||||||
return NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt);
|
return NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isDeleteStmt(SNode* pCurrStmt) {
|
||||||
|
return NULL != pCurrStmt && QUERY_NODE_DELETE_STMT == nodeType(pCurrStmt);
|
||||||
|
}
|
||||||
|
|
||||||
static bool isSetOperator(SNode* pCurrStmt) {
|
static bool isSetOperator(SNode* pCurrStmt) {
|
||||||
return NULL != pCurrStmt && QUERY_NODE_SET_OPERATOR == nodeType(pCurrStmt);
|
return NULL != pCurrStmt && QUERY_NODE_SET_OPERATOR == nodeType(pCurrStmt);
|
||||||
}
|
}
|
||||||
|
@ -669,6 +673,9 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
|
||||||
if (NULL != pCurrStmt && QUERY_NODE_CREATE_STREAM_STMT == nodeType(pCurrStmt)) {
|
if (NULL != pCurrStmt && QUERY_NODE_CREATE_STREAM_STMT == nodeType(pCurrStmt)) {
|
||||||
return getPrecisionFromCurrStmt(((SCreateStreamStmt*)pCurrStmt)->pQuery, defaultVal);
|
return getPrecisionFromCurrStmt(((SCreateStreamStmt*)pCurrStmt)->pQuery, defaultVal);
|
||||||
}
|
}
|
||||||
|
if (isDeleteStmt(pCurrStmt)) {
|
||||||
|
return ((SDeleteStmt*)pCurrStmt)->precision;
|
||||||
|
}
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,6 +1242,10 @@ static int32_t calcTypeBytes(SDataType dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
|
static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
|
||||||
|
if (pVal->translate) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
SDataType dt = pVal->node.resType;
|
SDataType dt = pVal->node.resType;
|
||||||
dt.bytes = calcTypeBytes(dt);
|
dt.bytes = calcTypeBytes(dt);
|
||||||
return translateValueImpl(pCxt, pVal, dt, false);
|
return translateValueImpl(pCxt, pVal, dt, false);
|
||||||
|
@ -1692,7 +1703,8 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
||||||
pSelect->hasUniqueFunc = pSelect->hasUniqueFunc ? true : (FUNCTION_TYPE_UNIQUE == pFunc->funcType);
|
pSelect->hasUniqueFunc = pSelect->hasUniqueFunc ? true : (FUNCTION_TYPE_UNIQUE == pFunc->funcType);
|
||||||
pSelect->hasTailFunc = pSelect->hasTailFunc ? true : (FUNCTION_TYPE_TAIL == pFunc->funcType);
|
pSelect->hasTailFunc = pSelect->hasTailFunc ? true : (FUNCTION_TYPE_TAIL == pFunc->funcType);
|
||||||
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
|
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
|
||||||
pSelect->hasInterpPseudoColFunc = pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId);
|
pSelect->hasInterpPseudoColFunc =
|
||||||
|
pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId);
|
||||||
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
|
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
|
||||||
pSelect->hasLastFunc = pSelect->hasLastFunc ? true : (FUNCTION_TYPE_LAST == pFunc->funcType);
|
pSelect->hasLastFunc = pSelect->hasLastFunc ? true : (FUNCTION_TYPE_LAST == pFunc->funcType);
|
||||||
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
|
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
|
||||||
|
@ -3372,7 +3384,8 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE);
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE);
|
||||||
}
|
}
|
||||||
if (pSelect->hasInterpPseudoColFunc) {
|
if (pSelect->hasInterpPseudoColFunc) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "Has Interp pseudo column(s) but missing interp function");
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
||||||
|
"Has Interp pseudo column(s) but missing interp function");
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -3741,6 +3754,7 @@ static int32_t translateDelete(STranslateContext* pCxt, SDeleteStmt* pDelete) {
|
||||||
pCxt->pCurrStmt = (SNode*)pDelete;
|
pCxt->pCurrStmt = (SNode*)pDelete;
|
||||||
int32_t code = translateFrom(pCxt, pDelete->pFromTable);
|
int32_t code = translateFrom(pCxt, pDelete->pFromTable);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
pDelete->precision = ((STableNode*)pDelete->pFromTable)->precision;
|
||||||
code = translateDeleteWhere(pCxt, pDelete);
|
code = translateDeleteWhere(pCxt, pDelete);
|
||||||
}
|
}
|
||||||
pCxt->currClause = SQL_CLAUSE_SELECT;
|
pCxt->currClause = SQL_CLAUSE_SELECT;
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
|
||||||
# ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
|
||||||
|
@ -785,6 +785,7 @@
|
||||||
,,y,script,./test.sh -f tsim/insert/query_multi_file.sim
|
,,y,script,./test.sh -f tsim/insert/query_multi_file.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/tcp.sim
|
,,y,script,./test.sh -f tsim/insert/tcp.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/update0.sim
|
,,y,script,./test.sh -f tsim/insert/update0.sim
|
||||||
|
,,y,script,./test.sh -f tsim/insert/delete0.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
|
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
|
||||||
,,y,script,./test.sh -f tsim/insert/update2.sim
|
,,y,script,./test.sh -f tsim/insert/update2.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
|
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== create database with different precision
|
||||||
|
sql create database d0 keep 365
|
||||||
|
sql create database d1 keep 365 precision 'ms'
|
||||||
|
sql create database d2 keep 365 precision 'us'
|
||||||
|
sql create database d3 keep 365 precision 'ns'
|
||||||
|
|
||||||
|
sql select * from information_schema.ins_databases
|
||||||
|
if $rows != 6 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data00 $data01 $data02
|
||||||
|
|
||||||
|
|
||||||
|
sql create table if not exists d0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
sql create table if not exists d1.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
sql create table if not exists d2.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
sql create table if not exists d3.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
|
||||||
|
sql create table if not exists d0.ntb (ts timestamp, c1 int, c2 float, c3 double)
|
||||||
|
sql create table if not exists d1.ntb (ts timestamp, c1 int, c2 float, c3 double)
|
||||||
|
sql create table if not exists d2.ntb (ts timestamp, c1 int, c2 float, c3 double)
|
||||||
|
sql create table if not exists d3.ntb (ts timestamp, c1 int, c2 float, c3 double)
|
||||||
|
|
||||||
|
sql create table d0.ct1 using d0.stb tags(1000)
|
||||||
|
sql create table d1.ct1 using d1.stb tags(1000)
|
||||||
|
sql create table d2.ct1 using d2.stb tags(1000)
|
||||||
|
sql create table d3.ct1 using d3.stb tags(1000)
|
||||||
|
sql create table d0.ct2 using d0.stb tags(1000)
|
||||||
|
sql create table d1.ct2 using d1.stb tags(1000)
|
||||||
|
sql create table d2.ct2 using d2.stb tags(1000)
|
||||||
|
sql create table d3.ct2 using d3.stb tags(1000)
|
||||||
|
|
||||||
|
|
||||||
|
sql insert into d0.ct1 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d1.ct1 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d2.ct1 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d3.ct1 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d0.ct2 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d1.ct2 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d2.ct2 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d3.ct2 values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d0.ntb values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d1.ntb values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d2.ntb values(now+0s, 10, 2.0, 3.0)
|
||||||
|
sql insert into d3.ntb values(now+0s, 10, 2.0, 3.0)
|
||||||
|
|
||||||
|
|
||||||
|
print =============== query data from super table
|
||||||
|
sql select count(*) from d0.stb
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d1.stb
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d2.stb
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d3.stb
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== delete from child table
|
||||||
|
sql delete from d0.ct1 where ts < now()
|
||||||
|
sql delete from d1.ct1 where ts < now()
|
||||||
|
sql delete from d2.ct1 where ts < now()
|
||||||
|
sql delete from d3.ct1 where ts < now()
|
||||||
|
|
||||||
|
|
||||||
|
print =============== query data from super table
|
||||||
|
sql select count(*) from d0.stb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d1.stb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d2.stb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d3.stb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
print =============== query data from normal table
|
||||||
|
sql select count(*) from d0.ntb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d1.ntb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d2.ntb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d3.ntb
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== delete from super table
|
||||||
|
sql delete from d0.stb where ts < now()
|
||||||
|
sql delete from d1.stb where ts < now()
|
||||||
|
sql delete from d2.stb where ts < now()
|
||||||
|
sql delete from d3.stb where ts < now()
|
||||||
|
|
||||||
|
print =============== query data from super table
|
||||||
|
sql select count(*) from d0.stb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d1.stb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d2.stb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d3.stb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== delete from normal table
|
||||||
|
sql delete from d0.ntb where ts < now()
|
||||||
|
sql delete from d1.ntb where ts < now()
|
||||||
|
sql delete from d2.ntb where ts < now()
|
||||||
|
sql delete from d3.ntb where ts < now()
|
||||||
|
|
||||||
|
print =============== query data from normal table
|
||||||
|
sql select count(*) from d0.ntb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d1.ntb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d2.ntb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select count(*) from d3.ntb
|
||||||
|
if $data00 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -53,7 +53,7 @@ sql insert into tbc values ("2021-05-11 10:12:29",36, 37, NULL, -4005)
|
||||||
sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
|
sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
|
||||||
|
|
||||||
run tsim/parser/last_cache_query.sim
|
run tsim/parser/last_cache_query.sim
|
||||||
|
sql flush database $db
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
|
|
@ -114,6 +114,7 @@ run tsim/insert/basic1.sim
|
||||||
run tsim/insert/commit-merge0.sim
|
run tsim/insert/commit-merge0.sim
|
||||||
run tsim/insert/basic0.sim
|
run tsim/insert/basic0.sim
|
||||||
run tsim/insert/update0.sim
|
run tsim/insert/update0.sim
|
||||||
|
run tsim/insert/delete0.sim
|
||||||
run tsim/insert/backquote.sim
|
run tsim/insert/backquote.sim
|
||||||
run tsim/insert/null.sim
|
run tsim/insert/null.sim
|
||||||
run tsim/catalog/alterInCurrent.sim
|
run tsim/catalog/alterInCurrent.sim
|
||||||
|
|
|
@ -20,8 +20,8 @@ class TDTestCase:
|
||||||
intData = []
|
intData = []
|
||||||
floatData = []
|
floatData = []
|
||||||
tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
|
tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
|
||||||
col7 int unsigned, col8 bigint unsigned, col9 float, col10 double, col11 bool, col12 binary(20), col13 nchar(20)) tags(loc nchar(20))''')
|
col7 int unsigned, col8 bigint unsigned, col9 float, col10 double, col11 bool, col12 binary(20), col13 nchar(20)) tags(t0 tinyint, t1 float, loc nchar(20))''')
|
||||||
tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')")
|
tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags(5, 5.5, 'beijing')")
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')"
|
tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')"
|
||||||
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
|
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
|
||||||
|
@ -62,6 +62,13 @@ class TDTestCase:
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 1, np.min(floatData))
|
tdSql.checkData(0, 1, np.min(floatData))
|
||||||
|
|
||||||
|
# check tags
|
||||||
|
tdSql.query(f"select max(t0) from {dbname}.stb")
|
||||||
|
tdSql.checkData(0,0,5)
|
||||||
|
|
||||||
|
tdSql.query(f"select max(t1) from {dbname}.stb")
|
||||||
|
tdSql.checkData(0,0,5.5)
|
||||||
|
|
||||||
def max_check_ntb_base(self, dbname="db"):
|
def max_check_ntb_base(self, dbname="db"):
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
intData = []
|
intData = []
|
||||||
|
|
Loading…
Reference in New Issue