Merge pull request #17343 from taosdata/enh/3.0_planner_optimize
enh: do coverity scan
This commit is contained in:
commit
075c2e9126
|
@ -478,7 +478,10 @@ static int32_t tlvDecodeValueEnum(STlvDecoder* pDecoder, void* pValue, int16_t l
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tlvDecodeCStr(STlv* pTlv, char* pValue) {
|
static int32_t tlvDecodeCStr(STlv* pTlv, char* pValue, int32_t size) {
|
||||||
|
if (pTlv->len > size - 1) {
|
||||||
|
return TSDB_CODE_FAILED;
|
||||||
|
}
|
||||||
memcpy(pValue, pTlv->value, pTlv->len);
|
memcpy(pValue, pTlv->value, pTlv->len);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -919,9 +922,14 @@ static int32_t msgToDatum(STlv* pTlv, void* pObj) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_JSON:
|
case TSDB_DATA_TYPE_JSON: {
|
||||||
|
if (pTlv->len <= 0 || pTlv->len > TSDB_MAX_JSON_TAG_LEN) {
|
||||||
|
code = TSDB_CODE_FAILED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
code = tlvDecodeDynBinary(pTlv, (void**)&pNode->datum.p);
|
code = tlvDecodeDynBinary(pTlv, (void**)&pNode->datum.p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case TSDB_DATA_TYPE_DECIMAL:
|
case TSDB_DATA_TYPE_DECIMAL:
|
||||||
case TSDB_DATA_TYPE_BLOB:
|
case TSDB_DATA_TYPE_BLOB:
|
||||||
// todo
|
// todo
|
||||||
|
@ -1097,7 +1105,7 @@ static int32_t msgToFunctionNode(STlvDecoder* pDecoder, void* pObj) {
|
||||||
code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
|
code = tlvDecodeObjFromTlv(pTlv, msgToExprNode, &pNode->node);
|
||||||
break;
|
break;
|
||||||
case FUNCTION_CODE_FUNCTION_NAME:
|
case FUNCTION_CODE_FUNCTION_NAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->functionName);
|
code = tlvDecodeCStr(pTlv, pNode->functionName, sizeof(pNode->functionName));
|
||||||
break;
|
break;
|
||||||
case FUNCTION_CODE_FUNCTION_ID:
|
case FUNCTION_CODE_FUNCTION_ID:
|
||||||
code = tlvDecodeI32(pTlv, &pNode->funcId);
|
code = tlvDecodeI32(pTlv, &pNode->funcId);
|
||||||
|
@ -1226,10 +1234,10 @@ static int32_t msgToName(STlvDecoder* pDecoder, void* pObj) {
|
||||||
code = tlvDecodeI32(pTlv, &pNode->acctId);
|
code = tlvDecodeI32(pTlv, &pNode->acctId);
|
||||||
break;
|
break;
|
||||||
case NAME_CODE_DB_NAME:
|
case NAME_CODE_DB_NAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->dbname);
|
code = tlvDecodeCStr(pTlv, pNode->dbname, sizeof(pNode->dbname));
|
||||||
break;
|
break;
|
||||||
case NAME_CODE_TABLE_NAME:
|
case NAME_CODE_TABLE_NAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->tname);
|
code = tlvDecodeCStr(pTlv, pNode->tname, sizeof(pNode->tname));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1538,7 +1546,7 @@ static int32_t msgToEp(STlvDecoder* pDecoder, void* pObj) {
|
||||||
tlvForEach(pDecoder, pTlv, code) {
|
tlvForEach(pDecoder, pTlv, code) {
|
||||||
switch (pTlv->type) {
|
switch (pTlv->type) {
|
||||||
case EP_CODE_FQDN:
|
case EP_CODE_FQDN:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->fqdn);
|
code = tlvDecodeCStr(pTlv, pNode->fqdn, sizeof(pNode->fqdn));
|
||||||
break;
|
break;
|
||||||
case EP_CODE_port:
|
case EP_CODE_port:
|
||||||
code = tlvDecodeU16(pTlv, &pNode->port);
|
code = tlvDecodeU16(pTlv, &pNode->port);
|
||||||
|
@ -3207,7 +3215,7 @@ static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) {
|
||||||
code = tlvDecodeI8(pTlv, &pNode->tableType);
|
code = tlvDecodeI8(pTlv, &pNode->tableType);
|
||||||
break;
|
break;
|
||||||
case PHY_QUERY_INSERT_CODE_TABLE_NAME:
|
case PHY_QUERY_INSERT_CODE_TABLE_NAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->tableName);
|
code = tlvDecodeCStr(pTlv, pNode->tableName, sizeof(pNode->tableName));
|
||||||
break;
|
break;
|
||||||
case PHY_QUERY_INSERT_CODE_VG_ID:
|
case PHY_QUERY_INSERT_CODE_VG_ID:
|
||||||
code = tlvDecodeI32(pTlv, &pNode->vgId);
|
code = tlvDecodeI32(pTlv, &pNode->vgId);
|
||||||
|
@ -3284,10 +3292,10 @@ static int32_t msgToPhysiDeleteNode(STlvDecoder* pDecoder, void* pObj) {
|
||||||
code = tlvDecodeI8(pTlv, &pNode->tableType);
|
code = tlvDecodeI8(pTlv, &pNode->tableType);
|
||||||
break;
|
break;
|
||||||
case PHY_DELETER_CODE_TABLE_FNAME:
|
case PHY_DELETER_CODE_TABLE_FNAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->tableFName);
|
code = tlvDecodeCStr(pTlv, pNode->tableFName, sizeof(pNode->tableFName));
|
||||||
break;
|
break;
|
||||||
case PHY_DELETER_CODE_TS_COL_NAME:
|
case PHY_DELETER_CODE_TS_COL_NAME:
|
||||||
code = tlvDecodeCStr(pTlv, pNode->tsColName);
|
code = tlvDecodeCStr(pTlv, pNode->tsColName, sizeof(pNode->tsColName));
|
||||||
break;
|
break;
|
||||||
case PHY_DELETER_CODE_DELETE_TIME_RANGE:
|
case PHY_DELETER_CODE_DELETE_TIME_RANGE:
|
||||||
code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->deleteTimeRange);
|
code = tlvDecodeObjFromTlv(pTlv, msgToTimeWindow, &pNode->deleteTimeRange);
|
||||||
|
|
|
@ -209,6 +209,10 @@ int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId);
|
SNodeAllocator* pAllocator = taosAcquireRef(g_allocatorReqRefPool, allocatorId);
|
||||||
|
if (NULL == pAllocator) {
|
||||||
|
nodesError("allocator id %" PRIx64 " weak reference failed", allocatorId);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return pAllocator->self;
|
return pAllocator->self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1716,9 +1720,10 @@ static EDealRes doCollect(SCollectColumnsCxt* pCxt, SColumnNode* pCol, SNode* pN
|
||||||
char name[TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN];
|
char name[TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN];
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
if ('\0' == pCol->tableAlias[0]) {
|
if ('\0' == pCol->tableAlias[0]) {
|
||||||
len = sprintf(name, "%s", pCol->colName);
|
len = snprintf(name, sizeof(name), "%s", pCol->colName);
|
||||||
|
} else {
|
||||||
|
len = snprintf(name, sizeof(name), "%s.%s", pCol->tableAlias, pCol->colName);
|
||||||
}
|
}
|
||||||
len = sprintf(name, "%s.%s", pCol->tableAlias, pCol->colName);
|
|
||||||
if (NULL == taosHashGet(pCxt->pColHash, name, len)) {
|
if (NULL == taosHashGet(pCxt->pColHash, name, len)) {
|
||||||
pCxt->errCode = taosHashPut(pCxt->pColHash, name, len, NULL, 0);
|
pCxt->errCode = taosHashPut(pCxt->pColHash, name, len, NULL, 0);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
|
|
|
@ -175,8 +175,6 @@ _end:
|
||||||
|
|
||||||
void taosCleanupKeywordsTable();
|
void taosCleanupKeywordsTable();
|
||||||
|
|
||||||
SToken tscReplaceStrToken(char **str, SToken *token, const char *newToken);
|
|
||||||
|
|
||||||
SToken taosTokenDup(SToken *pToken, char *buf, int32_t len);
|
SToken taosTokenDup(SToken *pToken, char *buf, int32_t len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -518,7 +518,7 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTa
|
||||||
if (NULL != pDbName) {
|
if (NULL != pDbName) {
|
||||||
COPY_STRING_FORM_ID_TOKEN(realTable->table.dbName, pDbName);
|
COPY_STRING_FORM_ID_TOKEN(realTable->table.dbName, pDbName);
|
||||||
} else {
|
} else {
|
||||||
strcpy(realTable->table.dbName, pCxt->pQueryCxt->db);
|
snprintf(realTable->table.dbName, sizeof(realTable->table.dbName), "%s", pCxt->pQueryCxt->db);
|
||||||
}
|
}
|
||||||
if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) {
|
if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) {
|
||||||
COPY_STRING_FORM_ID_TOKEN(realTable->table.tableAlias, pTableAlias);
|
COPY_STRING_FORM_ID_TOKEN(realTable->table.tableAlias, pTableAlias);
|
||||||
|
@ -599,7 +599,7 @@ SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr) {
|
||||||
state->pCol = createPrimaryKeyCol(pCxt, NULL);
|
state->pCol = createPrimaryKeyCol(pCxt, NULL);
|
||||||
if (NULL == state->pCol) {
|
if (NULL == state->pCol) {
|
||||||
nodesDestroyNode((SNode*)state);
|
nodesDestroyNode((SNode*)state);
|
||||||
CHECK_OUT_OF_MEM(state->pCol);
|
CHECK_OUT_OF_MEM(NULL);
|
||||||
}
|
}
|
||||||
state->pExpr = pExpr;
|
state->pExpr = pExpr;
|
||||||
return (SNode*)state;
|
return (SNode*)state;
|
||||||
|
@ -613,7 +613,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
|
||||||
interval->pCol = createPrimaryKeyCol(pCxt, NULL);
|
interval->pCol = createPrimaryKeyCol(pCxt, NULL);
|
||||||
if (NULL == interval->pCol) {
|
if (NULL == interval->pCol) {
|
||||||
nodesDestroyNode((SNode*)interval);
|
nodesDestroyNode((SNode*)interval);
|
||||||
CHECK_OUT_OF_MEM(interval->pCol);
|
CHECK_OUT_OF_MEM(NULL);
|
||||||
}
|
}
|
||||||
interval->pInterval = pInterval;
|
interval->pInterval = pInterval;
|
||||||
interval->pOffset = pOffset;
|
interval->pOffset = pOffset;
|
||||||
|
@ -631,7 +631,7 @@ SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) {
|
||||||
fill->pWStartTs = nodesMakeNode(QUERY_NODE_FUNCTION);
|
fill->pWStartTs = nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||||
if (NULL == fill->pWStartTs) {
|
if (NULL == fill->pWStartTs) {
|
||||||
nodesDestroyNode((SNode*)fill);
|
nodesDestroyNode((SNode*)fill);
|
||||||
CHECK_OUT_OF_MEM(fill->pWStartTs);
|
CHECK_OUT_OF_MEM(NULL);
|
||||||
}
|
}
|
||||||
strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstart");
|
strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstart");
|
||||||
return (SNode*)fill;
|
return (SNode*)fill;
|
||||||
|
@ -1495,10 +1495,10 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
pStmt->indexType = type;
|
pStmt->indexType = type;
|
||||||
pStmt->ignoreExists = ignoreExists;
|
pStmt->ignoreExists = ignoreExists;
|
||||||
strcpy(pStmt->indexDbName, ((SRealTableNode*)pIndexName)->table.dbName);
|
snprintf(pStmt->indexDbName, sizeof(pStmt->indexDbName), "%s", ((SRealTableNode*)pIndexName)->table.dbName);
|
||||||
strcpy(pStmt->indexName, ((SRealTableNode*)pIndexName)->table.tableName);
|
snprintf(pStmt->indexName, sizeof(pStmt->indexName), "%s", ((SRealTableNode*)pIndexName)->table.tableName);
|
||||||
strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName);
|
snprintf(pStmt->dbName, sizeof(pStmt->dbName), "%s", ((SRealTableNode*)pRealTable)->table.dbName);
|
||||||
strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName);
|
snprintf(pStmt->tableName, sizeof(pStmt->tableName), "%s", ((SRealTableNode*)pRealTable)->table.tableName);
|
||||||
nodesDestroyNode(pIndexName);
|
nodesDestroyNode(pIndexName);
|
||||||
nodesDestroyNode(pRealTable);
|
nodesDestroyNode(pRealTable);
|
||||||
pStmt->pCols = pCols;
|
pStmt->pCols = pCols;
|
||||||
|
@ -1524,8 +1524,8 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode*
|
||||||
SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT);
|
SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
pStmt->ignoreNotExists = ignoreNotExists;
|
pStmt->ignoreNotExists = ignoreNotExists;
|
||||||
strcpy(pStmt->indexDbName, ((SRealTableNode*)pIndexName)->table.dbName);
|
snprintf(pStmt->indexDbName, sizeof(pStmt->indexDbName), "%s", ((SRealTableNode*)pIndexName)->table.dbName);
|
||||||
strcpy(pStmt->indexName, ((SRealTableNode*)pIndexName)->table.tableName);
|
snprintf(pStmt->indexName, sizeof(pStmt->indexName), "%s", ((SRealTableNode*)pIndexName)->table.tableName);
|
||||||
nodesDestroyNode(pIndexName);
|
nodesDestroyNode(pIndexName);
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
@ -1818,7 +1818,7 @@ SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDb
|
||||||
SNode* createFuncForDelete(SAstCreateContext* pCxt, const char* pFuncName) {
|
SNode* createFuncForDelete(SAstCreateContext* pCxt, const char* pFuncName) {
|
||||||
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||||
CHECK_OUT_OF_MEM(pFunc);
|
CHECK_OUT_OF_MEM(pFunc);
|
||||||
strcpy(pFunc->functionName, pFuncName);
|
snprintf(pFunc->functionName, sizeof(pFunc->functionName), "%s", pFuncName);
|
||||||
if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createPrimaryKeyCol(pCxt, NULL))) {
|
if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createPrimaryKeyCol(pCxt, NULL))) {
|
||||||
nodesDestroyNode((SNode*)pFunc);
|
nodesDestroyNode((SNode*)pFunc);
|
||||||
CHECK_OUT_OF_MEM(NULL);
|
CHECK_OUT_OF_MEM(NULL);
|
||||||
|
|
|
@ -378,7 +378,9 @@ static int parseTime(char** end, SToken* pToken, int16_t timePrec, int64_t* time
|
||||||
} else if (pToken->type == TK_TODAY) {
|
} else if (pToken->type == TK_TODAY) {
|
||||||
ts = taosGetTimestampToday(timePrec);
|
ts = taosGetTimestampToday(timePrec);
|
||||||
} else if (pToken->type == TK_NK_INTEGER) {
|
} else if (pToken->type == TK_NK_INTEGER) {
|
||||||
toInteger(pToken->z, pToken->n, 10, &ts);
|
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, &ts)) {
|
||||||
|
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
||||||
|
}
|
||||||
} else { // parse the RFC-3339/ISO-8601 timestamp format string
|
} else { // parse the RFC-3339/ISO-8601 timestamp format string
|
||||||
if (taosParseTime(pToken->z, time, pToken->n, timePrec, tsDaylight) != TSDB_CODE_SUCCESS) {
|
if (taosParseTime(pToken->z, time, pToken->n, timePrec, tsDaylight) != TSDB_CODE_SUCCESS) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp format", pToken->z);
|
||||||
|
@ -591,8 +593,6 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
|
||||||
case TSDB_DATA_TYPE_BIGINT: {
|
case TSDB_DATA_TYPE_BIGINT: {
|
||||||
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, &iv)) {
|
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, &iv)) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "invalid bigint data", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "invalid bigint data", pToken->z);
|
||||||
} else if (!IS_VALID_BIGINT(iv)) {
|
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "bigint data overflow", pToken->z);
|
|
||||||
}
|
}
|
||||||
return func(pMsgBuf, &iv, pSchema->bytes, param);
|
return func(pMsgBuf, &iv, pSchema->bytes, param);
|
||||||
}
|
}
|
||||||
|
@ -894,10 +894,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16
|
||||||
case TSDB_DATA_TYPE_BIGINT: {
|
case TSDB_DATA_TYPE_BIGINT: {
|
||||||
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, &iv)) {
|
if (TSDB_CODE_SUCCESS != toInteger(pToken->z, pToken->n, 10, &iv)) {
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "invalid bigint data", pToken->z);
|
return buildSyntaxErrMsg(pMsgBuf, "invalid bigint data", pToken->z);
|
||||||
} else if (!IS_VALID_BIGINT(iv)) {
|
|
||||||
return buildSyntaxErrMsg(pMsgBuf, "bigint data overflow", pToken->z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val->i64 = iv;
|
val->i64 = iv;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1170,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName*
|
||||||
NEXT_TOKEN(pCxt->pSql, sToken);
|
NEXT_TOKEN(pCxt->pSql, sToken);
|
||||||
|
|
||||||
SName sname;
|
SName sname;
|
||||||
createSName(&sname, &sToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg);
|
CHECK_CODE(createSName(&sname, &sToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
tNameGetFullDbName(&sname, dbFName);
|
tNameGetFullDbName(&sname, dbFName);
|
||||||
strcpy(pCxt->sTableName, sname.tname);
|
strcpy(pCxt->sTableName, sname.tname);
|
||||||
|
@ -1605,7 +1602,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
if (!pCxt->pComCxt->needMultiParse) {
|
if (!pCxt->pComCxt->needMultiParse) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
parserInfo("0x%" PRIx64 " insert from csv. File is too large, do it in batches.", pCxt->pComCxt->requestId);
|
parserDebug("0x%" PRIx64 " insert from csv. File is too large, do it in batches.", pCxt->pComCxt->requestId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1610,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
|
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
parserInfo("0x%" PRIx64 " insert input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum);
|
parserDebug("0x%" PRIx64 " insert input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum);
|
||||||
|
|
||||||
if (TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) {
|
if (TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) {
|
||||||
SParsedDataColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
|
SParsedDataColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
|
||||||
|
@ -1650,7 +1647,7 @@ static int32_t parseInsertBodyAgain(SInsertParseContext* pCxt) {
|
||||||
pCxt->pComCxt->needMultiParse = false;
|
pCxt->pComCxt->needMultiParse = false;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
parserInfo("0x%" PRIx64 " insert again input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum);
|
parserDebug("0x%" PRIx64 " insert again input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum);
|
||||||
// merge according to vgId
|
// merge according to vgId
|
||||||
if (taosHashGetSize(pCxt->pTableBlockHashObj) > 0) {
|
if (taosHashGetSize(pCxt->pTableBlockHashObj) > 0) {
|
||||||
CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks));
|
CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks));
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
// clang-format off
|
|
||||||
#include "parInsertData.h"
|
#include "parInsertData.h"
|
||||||
|
|
||||||
#include "catalog.h"
|
#include "catalog.h"
|
||||||
|
@ -211,19 +211,19 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pBuf= pBlocks->pData + pBlocks->size;
|
pBuf = pBlocks->pData + pBlocks->size;
|
||||||
|
|
||||||
tEncoderInit(&coder, pBuf, len);
|
tEncoderInit(&coder, pBuf, len);
|
||||||
tEncodeSVCreateTbReq(&coder, pCreateTbReq);
|
int32_t code = tEncodeSVCreateTbReq(&coder, pCreateTbReq);
|
||||||
tEncoderClear(&coder);
|
tEncoderClear(&coder);
|
||||||
|
|
||||||
pBlocks->size += len;
|
pBlocks->size += len;
|
||||||
pBlocks->createTbReqLen = len;
|
pBlocks->createTbReqLen = len;
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset, int32_t rowSize,
|
int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset,
|
||||||
STableMeta* pTableMeta, STableDataBlocks** dataBlocks, SArray* pBlockList,
|
int32_t rowSize, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, SArray* pBlockList,
|
||||||
SVCreateTbReq* pCreateTbReq) {
|
SVCreateTbReq* pCreateTbReq) {
|
||||||
*dataBlocks = NULL;
|
*dataBlocks = NULL;
|
||||||
STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)id, idLen);
|
STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)id, idLen);
|
||||||
|
@ -272,12 +272,12 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) {
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(pDataBlock->pData);
|
taosMemoryFreeClear(pDataBlock->pData);
|
||||||
// if (!pDataBlock->cloned) {
|
// if (!pDataBlock->cloned) {
|
||||||
// free the refcount for metermeta
|
// free the refcount for metermeta
|
||||||
taosMemoryFreeClear(pDataBlock->pTableMeta);
|
taosMemoryFreeClear(pDataBlock->pTableMeta);
|
||||||
|
|
||||||
destroyBoundColumnInfo(&pDataBlock->boundColumnInfo);
|
destroyBoundColumnInfo(&pDataBlock->boundColumnInfo);
|
||||||
// }
|
// }
|
||||||
taosMemoryFreeClear(pDataBlock);
|
taosMemoryFreeClear(pDataBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,16 +687,16 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p
|
||||||
STableDataBlocks** p = taosHashIterate(pHashObj, NULL);
|
STableDataBlocks** p = taosHashIterate(pHashObj, NULL);
|
||||||
STableDataBlocks* pOneTableBlock = *p;
|
STableDataBlocks* pOneTableBlock = *p;
|
||||||
SBlockKeyInfo blkKeyInfo = {0}; // share by pOneTableBlock
|
SBlockKeyInfo blkKeyInfo = {0}; // share by pOneTableBlock
|
||||||
SBlockRowMerger *pBlkRowMerger = NULL;
|
SBlockRowMerger* pBlkRowMerger = NULL;
|
||||||
|
|
||||||
while (pOneTableBlock) {
|
while (pOneTableBlock) {
|
||||||
SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData;
|
SSubmitBlk* pBlocks = (SSubmitBlk*)pOneTableBlock->pData;
|
||||||
if (pBlocks->numOfRows > 0) {
|
if (pBlocks->numOfRows > 0) {
|
||||||
STableDataBlocks* dataBuf = NULL;
|
STableDataBlocks* dataBuf = NULL;
|
||||||
pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId
|
pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId
|
||||||
int32_t ret =
|
int32_t ret = getDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, sizeof(pOneTableBlock->vgId),
|
||||||
getDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, sizeof(pOneTableBlock->vgId), TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0,
|
TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0, pOneTableBlock->pTableMeta, &dataBuf,
|
||||||
pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL);
|
pVnodeDataBlockList, NULL);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
tdFreeSBlockRowMerger(pBlkRowMerger);
|
tdFreeSBlockRowMerger(pBlkRowMerger);
|
||||||
taosHashCleanup(pVnodeDataBlockHashList);
|
taosHashCleanup(pVnodeDataBlockHashList);
|
||||||
|
@ -708,7 +708,8 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p
|
||||||
// the maximum expanded size in byte when a row-wise data is converted to SDataRow format
|
// the maximum expanded size in byte when a row-wise data is converted to SDataRow format
|
||||||
int32_t expandSize = isRawPayload ? getRowExpandSize(pOneTableBlock->pTableMeta) : 0;
|
int32_t expandSize = isRawPayload ? getRowExpandSize(pOneTableBlock->pTableMeta) : 0;
|
||||||
int64_t destSize = dataBuf->size + pOneTableBlock->size + pBlocks->numOfRows * expandSize +
|
int64_t destSize = dataBuf->size + pOneTableBlock->size + pBlocks->numOfRows * expandSize +
|
||||||
sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + pOneTableBlock->createTbReqLen;
|
sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) +
|
||||||
|
pOneTableBlock->createTbReqLen;
|
||||||
|
|
||||||
if (dataBuf->nAllocSize < destSize) {
|
if (dataBuf->nAllocSize < destSize) {
|
||||||
dataBuf->nAllocSize = (uint32_t)(destSize * 1.5);
|
dataBuf->nAllocSize = (uint32_t)(destSize * 1.5);
|
||||||
|
@ -861,7 +862,7 @@ int32_t qCloneStmtDataBlock(void** pDst, void* pSrc) {
|
||||||
|
|
||||||
STableDataBlocks* pBlock = (STableDataBlocks*)(*pDst);
|
STableDataBlocks* pBlock = (STableDataBlocks*)(*pDst);
|
||||||
if (pBlock->pTableMeta) {
|
if (pBlock->pTableMeta) {
|
||||||
void *pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pBlock->pTableMeta));
|
void* pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pBlock->pTableMeta));
|
||||||
if (NULL == pNewMeta) {
|
if (NULL == pNewMeta) {
|
||||||
taosMemoryFreeClear(*pDst);
|
taosMemoryFreeClear(*pDst);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -898,9 +899,7 @@ int32_t qRebuildStmtDataBlock(void** pDst, void* pSrc, uint64_t uid, int32_t vgI
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta *qGetTableMetaInDataBlock(void* pDataBlock) {
|
STableMeta* qGetTableMetaInDataBlock(void* pDataBlock) { return ((STableDataBlocks*)pDataBlock)->pTableMeta; }
|
||||||
return ((STableDataBlocks*)pDataBlock)->pTableMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qFreeStmtDataBlock(void* pDataBlock) {
|
void qFreeStmtDataBlock(void* pDataBlock) {
|
||||||
if (pDataBlock == NULL) {
|
if (pDataBlock == NULL) {
|
||||||
|
|
|
@ -613,27 +613,6 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SToken tscReplaceStrToken(char** str, SToken* token, const char* newToken) {
|
|
||||||
char* src = *str;
|
|
||||||
size_t nsize = strlen(newToken);
|
|
||||||
int32_t size = (int32_t)strlen(*str) - token->n + (int32_t)nsize + 1;
|
|
||||||
int32_t bsize = (int32_t)((uint64_t)token->z - (uint64_t)src);
|
|
||||||
SToken ntoken;
|
|
||||||
|
|
||||||
*str = taosMemoryCalloc(1, size);
|
|
||||||
|
|
||||||
strncpy(*str, src, bsize);
|
|
||||||
strcat(*str, newToken);
|
|
||||||
strcat(*str, token->z + token->n);
|
|
||||||
|
|
||||||
ntoken.n = (uint32_t)nsize;
|
|
||||||
ntoken.z = *str + bsize;
|
|
||||||
|
|
||||||
taosMemoryFreeClear(src);
|
|
||||||
|
|
||||||
return ntoken;
|
|
||||||
}
|
|
||||||
|
|
||||||
SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
|
SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
|
||||||
SToken t0 = {0};
|
SToken t0 = {0};
|
||||||
|
|
||||||
|
|
|
@ -292,9 +292,13 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
SArray* pTables = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
SArray* pTables = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||||
|
if (NULL == pTables) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
if (pCxt->currLevel == currTotalLevel) {
|
if (pCxt->currLevel == currTotalLevel) {
|
||||||
taosArrayPush(pTables, &pTable);
|
taosArrayPush(pTables, &pTable);
|
||||||
if (hasSameTableAlias(pTables)) {
|
if (hasSameTableAlias(pTables)) {
|
||||||
|
taosArrayDestroy(pTables);
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||||
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
||||||
}
|
}
|
||||||
|
@ -308,7 +312,7 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
||||||
|
|
||||||
static int32_t collectUseDatabaseImpl(const char* pFullDbName, SHashObj* pDbs) {
|
static int32_t collectUseDatabaseImpl(const char* pFullDbName, SHashObj* pDbs) {
|
||||||
SFullDatabaseName name = {0};
|
SFullDatabaseName name = {0};
|
||||||
strcpy(name.fullDbName, pFullDbName);
|
snprintf(name.fullDbName, sizeof(name.fullDbName), "%s", pFullDbName);
|
||||||
return taosHashPut(pDbs, pFullDbName, strlen(pFullDbName), &name, sizeof(SFullDatabaseName));
|
return taosHashPut(pDbs, pFullDbName, strlen(pFullDbName), &name, sizeof(SFullDatabaseName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,6 +544,7 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = collectUseTable(pName, pCxt->pTables);
|
code = collectUseTable(pName, pCxt->pTables);
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (pParCxt->async) {
|
if (pParCxt->async) {
|
||||||
code = getTableIndexFromCache(pCxt->pMetaCache, pName, pIndexes);
|
code = getTableIndexFromCache(pCxt->pMetaCache, pName, pIndexes);
|
||||||
} else {
|
} else {
|
||||||
|
@ -550,6 +555,7 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray
|
||||||
|
|
||||||
code = catalogGetTableIndex(pParCxt->pCatalog, &conn, pName, pIndexes);
|
code = catalogGetTableIndex(pParCxt->pCatalog, &conn, pName, pIndexes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
parserError("0x%" PRIx64 " getTableIndex error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId,
|
parserError("0x%" PRIx64 " getTableIndex error, code:%s, dbName:%s, tbName:%s", pCxt->pParseCxt->requestId,
|
||||||
tstrerror(code), pName->dbname, pName->tname);
|
tstrerror(code), pName->dbname, pName->tname);
|
||||||
|
@ -990,9 +996,9 @@ static int32_t parseTimeFromValueNode(STranslateContext* pCxt, SValueNode* pVal)
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
}
|
}
|
||||||
if (IS_UNSIGNED_NUMERIC_TYPE(pVal->node.resType.type)) {
|
if (IS_UNSIGNED_NUMERIC_TYPE(pVal->node.resType.type)) {
|
||||||
pVal->datum.i = pVal->datum.u;
|
pVal->datum.i = (int64_t)pVal->datum.u;
|
||||||
} else if (IS_FLOAT_TYPE(pVal->node.resType.type)) {
|
} else if (IS_FLOAT_TYPE(pVal->node.resType.type)) {
|
||||||
pVal->datum.i = pVal->datum.d;
|
pVal->datum.i = (int64_t)pVal->datum.d;
|
||||||
} else if (TSDB_DATA_TYPE_BOOL == pVal->node.resType.type) {
|
} else if (TSDB_DATA_TYPE_BOOL == pVal->node.resType.type) {
|
||||||
pVal->datum.i = pVal->datum.b;
|
pVal->datum.i = pVal->datum.b;
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1075,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_BIGINT: {
|
case TSDB_DATA_TYPE_BIGINT: {
|
||||||
code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i);
|
code = toInteger(pVal->literal, strlen(pVal->literal), 10, &pVal->datum.i);
|
||||||
if (strict && (TSDB_CODE_SUCCESS != code || !IS_VALID_BIGINT(pVal->datum.i))) {
|
if (strict && TSDB_CODE_SUCCESS != code) {
|
||||||
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
|
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
|
||||||
}
|
}
|
||||||
*(int64_t*)&pVal->typeData = pVal->datum.i;
|
*(int64_t*)&pVal->typeData = pVal->datum.i;
|
||||||
|
@ -3430,10 +3436,10 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCol->node.resType = ((SExprNode*)pNode)->resType;
|
pCol->node.resType = ((SExprNode*)pNode)->resType;
|
||||||
strcpy(pCol->tableAlias, pTableAlias);
|
snprintf(pCol->tableAlias, sizeof(pCol->tableAlias), "%s", pTableAlias);
|
||||||
strcpy(pCol->colName, ((SExprNode*)pNode)->aliasName);
|
snprintf(pCol->colName, sizeof(pCol->colName), "%s", ((SExprNode*)pNode)->aliasName);
|
||||||
strcpy(pCol->node.aliasName, pCol->colName);
|
snprintf(pCol->node.aliasName, sizeof(pCol->node.aliasName), "%s", pCol->colName);
|
||||||
strcpy(pCol->node.userAlias, ((SExprNode*)pNode)->userAlias);
|
snprintf(pCol->node.userAlias, sizeof(pCol->node.userAlias), "%s", ((SExprNode*)pNode)->userAlias);
|
||||||
return (SNode*)pCol;
|
return (SNode*)pCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3740,8 +3746,8 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
|
||||||
static int32_t checkRangeOption(STranslateContext* pCxt, int32_t code, const char* pName, int32_t val, int32_t minVal,
|
static int32_t checkRangeOption(STranslateContext* pCxt, int32_t code, const char* pName, int32_t val, int32_t minVal,
|
||||||
int32_t maxVal) {
|
int32_t maxVal) {
|
||||||
if (val >= 0 && (val < minVal || val > maxVal)) {
|
if (val >= 0 && (val < minVal || val > maxVal)) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, code, "Invalid option %s: %" PRId64 " valid range: [%d, %d]", pName,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, code, "Invalid option %s: %d valid range: [%d, %d]", pName, val,
|
||||||
val, minVal, maxVal);
|
minVal, maxVal);
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -3878,7 +3884,7 @@ static int32_t checkDbStrictOption(STranslateContext* pCxt, SDatabaseOptions* pO
|
||||||
static int32_t checkDbEnumOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t v1, int32_t v2) {
|
static int32_t checkDbEnumOption(STranslateContext* pCxt, const char* pName, int32_t val, int32_t v1, int32_t v2) {
|
||||||
if (val >= 0 && val != v1 && val != v2) {
|
if (val >= 0 && val != v1 && val != v2) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION,
|
||||||
"Invalid option %s: %" PRId64 ", only %d, %d allowed", pName, val, v1, v2);
|
"Invalid option %s: %d, only %d, %d allowed", pName, val, v1, v2);
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -4463,8 +4469,8 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
|
||||||
nodesDestroyNode((SNode*)pSelect);
|
nodesDestroyNode((SNode*)pSelect);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strcpy(pTable->table.dbName, pInfo->pDbName);
|
snprintf(pTable->table.dbName, sizeof(pTable->table.dbName), "%s", pInfo->pDbName);
|
||||||
strcpy(pTable->table.tableName, pInfo->pTableName);
|
snprintf(pTable->table.tableName, sizeof(pTable->table.tableName), "%s", pInfo->pTableName);
|
||||||
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta);
|
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta);
|
||||||
pSelect->pFromTable = (SNode*)pTable;
|
pSelect->pFromTable = (SNode*)pTable;
|
||||||
|
|
||||||
|
@ -4940,9 +4946,9 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
|
||||||
alterReq.superUser = 0;
|
alterReq.superUser = 0;
|
||||||
alterReq.enable = pStmt->enable;
|
alterReq.enable = pStmt->enable;
|
||||||
alterReq.sysInfo = pStmt->sysinfo;
|
alterReq.sysInfo = pStmt->sysinfo;
|
||||||
strcpy(alterReq.pass, pStmt->password);
|
snprintf(alterReq.pass, sizeof(alterReq.pass), "%s", pStmt->password);
|
||||||
if (NULL != pCxt->pParseCxt->db) {
|
if (NULL != pCxt->pParseCxt->db) {
|
||||||
strcpy(alterReq.dbname, pCxt->pParseCxt->db);
|
snprintf(alterReq.dbname, sizeof(alterReq.dbname), "%s", pCxt->pParseCxt->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
||||||
|
@ -6049,7 +6055,7 @@ static SNode* createProjectCol(const char* pProjCol) {
|
||||||
if (NULL == pCol) {
|
if (NULL == pCol) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(pCol->colName, pProjCol);
|
snprintf(pCol->colName, sizeof(pCol->colName), "%s", pProjCol);
|
||||||
return (SNode*)pCol;
|
return (SNode*)pCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6082,9 +6088,9 @@ static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, int32
|
||||||
nodesDestroyNode((SNode*)pSelect);
|
nodesDestroyNode((SNode*)pSelect);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strcpy(pRealTable->table.dbName, pDb);
|
snprintf(pRealTable->table.dbName, sizeof(pRealTable->table.dbName), "%s", pDb);
|
||||||
strcpy(pRealTable->table.tableName, pTable);
|
snprintf(pRealTable->table.tableName, sizeof(pRealTable->table.tableName), "%s", pTable);
|
||||||
strcpy(pRealTable->table.tableAlias, pTable);
|
snprintf(pRealTable->table.tableAlias, sizeof(pRealTable->table.tableAlias), "%s", pTable);
|
||||||
pSelect->pFromTable = (SNode*)pRealTable;
|
pSelect->pFromTable = (SNode*)pRealTable;
|
||||||
|
|
||||||
if (numOfProjs >= 0) {
|
if (numOfProjs >= 0) {
|
||||||
|
@ -7125,8 +7131,9 @@ static int32_t buildUpdateOptionsReq(STranslateContext* pCxt, SAlterTableStmt* p
|
||||||
pReq->newComment = strdup(pStmt->pOptions->comment);
|
pReq->newComment = strdup(pStmt->pOptions->comment);
|
||||||
if (NULL == pReq->newComment) {
|
if (NULL == pReq->newComment) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
} else {
|
||||||
pReq->newCommentLen = strlen(pReq->newComment);
|
pReq->newCommentLen = strlen(pReq->newComment);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pReq->newCommentLen = -1;
|
pReq->newCommentLen = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
|
||||||
uError("charset:%s to %s. val:%s, errno:%s, convert failed.", DEFAULT_UNICODE_ENCODEC, tsCharset, jsonValue,
|
uError("charset:%s to %s. val:%s, errno:%s, convert failed.", DEFAULT_UNICODE_ENCODEC, tsCharset, jsonValue,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
retCode = buildSyntaxErrMsg(pMsgBuf, "charset convert json error", jsonValue);
|
retCode = buildSyntaxErrMsg(pMsgBuf, "charset convert json error", jsonValue);
|
||||||
|
taosMemoryFree(tmp);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
val.nData = valLen;
|
val.nData = valLen;
|
||||||
|
@ -652,8 +653,8 @@ static int32_t buildCatalogReqForInsert(SParseContext* pCxt, const SParseMetaCac
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserAuthInfo auth = {0};
|
SUserAuthInfo auth = {0};
|
||||||
strcpy(auth.user, pCxt->pUser);
|
snprintf(auth.user, sizeof(auth.user), "%s", pCxt->pUser);
|
||||||
strcpy(auth.dbFName, p->dbFName);
|
snprintf(auth.dbFName, sizeof(auth.dbFName), "%s", p->dbFName);
|
||||||
auth.type = AUTH_TYPE_WRITE;
|
auth.type = AUTH_TYPE_WRITE;
|
||||||
taosArrayPush(pCatalogReq->pUser, &auth);
|
taosArrayPush(pCatalogReq->pUser, &auth);
|
||||||
|
|
||||||
|
|
|
@ -471,9 +471,9 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pCol->node.resType = pExpr->resType;
|
pCol->node.resType = pExpr->resType;
|
||||||
strcpy(pCol->colName, pExpr->aliasName);
|
snprintf(pCol->colName, sizeof(pCol->colName), "%s", pExpr->aliasName);
|
||||||
if (NULL != pStmtName) {
|
if (NULL != pStmtName) {
|
||||||
strcpy(pCol->tableAlias, pStmtName);
|
snprintf(pCol->tableAlias, sizeof(pCol->tableAlias), "%s", pStmtName);
|
||||||
}
|
}
|
||||||
return pCol;
|
return pCol;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ static int32_t sortPriKeyOptGetSequencingNodes(SLogicNode* pNode, SNodeList** pS
|
||||||
bool notOptimize = false;
|
bool notOptimize = false;
|
||||||
int32_t code = sortPriKeyOptGetSequencingNodesImpl(pNode, ¬Optimize, pSequencingNodes);
|
int32_t code = sortPriKeyOptGetSequencingNodesImpl(pNode, ¬Optimize, pSequencingNodes);
|
||||||
if (TSDB_CODE_SUCCESS != code || notOptimize) {
|
if (TSDB_CODE_SUCCESS != code || notOptimize) {
|
||||||
nodesClearList(*pSequencingNodes);
|
NODES_CLEAR_LIST(*pSequencingNodes);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1361,74 +1361,6 @@ static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SNode* smaIndexOptCreateWStartTs() {
|
|
||||||
SFunctionNode* pWStart = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
|
||||||
if (NULL == pWStart) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
strcpy(pWStart->functionName, "_wstart");
|
|
||||||
snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart);
|
|
||||||
if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pWStart, NULL, 0)) {
|
|
||||||
nodesDestroyNode((SNode*)pWStart);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return (SNode*)pWStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t smaIndexOptCreateMergeKey(SNode* pCol, SNodeList** pMergeKeys) {
|
|
||||||
SOrderByExprNode* pMergeKey = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR);
|
|
||||||
if (NULL == pMergeKey) {
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
pMergeKey->pExpr = nodesCloneNode(pCol);
|
|
||||||
if (NULL == pMergeKey->pExpr) {
|
|
||||||
nodesDestroyNode((SNode*)pMergeKey);
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
pMergeKey->order = ORDER_ASC;
|
|
||||||
pMergeKey->nullOrder = NULL_ORDER_FIRST;
|
|
||||||
return nodesListMakeStrictAppend(pMergeKeys, (SNode*)pMergeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t smaIndexOptRewriteInterval(SWindowLogicNode* pInterval, int32_t wstrartIndex, SNodeList** pMergeKeys) {
|
|
||||||
if (wstrartIndex < 0) {
|
|
||||||
SNode* pWStart = smaIndexOptCreateWStartTs();
|
|
||||||
if (NULL == pWStart) {
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
int32_t code = createColumnByRewriteExpr(pWStart, &pInterval->node.pTargets);
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
|
||||||
nodesDestroyNode(pWStart);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
wstrartIndex = LIST_LENGTH(pInterval->node.pTargets) - 1;
|
|
||||||
}
|
|
||||||
return smaIndexOptCreateMergeKey(nodesListGetNode(pInterval->node.pTargets, wstrartIndex), pMergeKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t smaIndexOptApplyIndexExt(SLogicSubplan* pLogicSubplan, SScanLogicNode* pScan, STableIndexInfo* pIndex,
|
|
||||||
SNodeList* pSmaCols, int32_t wstrartIndex) {
|
|
||||||
SWindowLogicNode* pInterval = (SWindowLogicNode*)pScan->node.pParent;
|
|
||||||
SNodeList* pMergeTargets = nodesCloneList(pInterval->node.pTargets);
|
|
||||||
if (NULL == pMergeTargets) {
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
SLogicNode* pSmaScan = NULL;
|
|
||||||
SLogicNode* pMerge = NULL;
|
|
||||||
SNodeList* pMergeKeys = NULL;
|
|
||||||
int32_t code = smaIndexOptRewriteInterval(pInterval, wstrartIndex, &pMergeKeys);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = smaIndexOptCreateSmaScan(pScan, pIndex, pSmaCols, &pSmaScan);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = smaIndexOptCreateMerge(pScan->node.pParent, pMergeKeys, pMergeTargets, &pMerge);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = smaIndexOptRecombinationNode(pLogicSubplan, pScan->node.pParent, pMerge, pSmaScan);
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t smaIndexOptApplyIndex(SLogicSubplan* pLogicSubplan, SScanLogicNode* pScan, STableIndexInfo* pIndex,
|
static int32_t smaIndexOptApplyIndex(SLogicSubplan* pLogicSubplan, SScanLogicNode* pScan, STableIndexInfo* pIndex,
|
||||||
SNodeList* pSmaCols, int32_t wstrartIndex) {
|
SNodeList* pSmaCols, int32_t wstrartIndex) {
|
||||||
SLogicNode* pSmaScan = NULL;
|
SLogicNode* pSmaScan = NULL;
|
||||||
|
@ -1559,7 +1491,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pFunc->functionName, pFuncName);
|
snprintf(pFunc->functionName, sizeof(pFunc->functionName), "%s", pFuncName);
|
||||||
if (QUERY_NODE_COLUMN == nodeType(pNode) && COLUMN_TYPE_TBNAME != ((SColumnNode*)pNode)->colType) {
|
if (QUERY_NODE_COLUMN == nodeType(pNode) && COLUMN_TYPE_TBNAME != ((SColumnNode*)pNode)->colType) {
|
||||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||||
partTagsSetAlias(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), pCol->tableAlias, pCol->colName);
|
partTagsSetAlias(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), pCol->tableAlias, pCol->colName);
|
||||||
|
@ -2028,7 +1960,7 @@ static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode
|
||||||
if (NULL != pSelectValue) {
|
if (NULL != pSelectValue) {
|
||||||
strcpy(pFunc->node.aliasName, pSelectValue->node.aliasName);
|
strcpy(pFunc->node.aliasName, pSelectValue->node.aliasName);
|
||||||
} else {
|
} else {
|
||||||
snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%p", pFunc->functionName, pFunc);
|
snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%p", pFunc->functionName, (void*)pFunc);
|
||||||
}
|
}
|
||||||
int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pCol));
|
int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pCol));
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ static SNode* createSlotDesc(SPhysiPlanContext* pCxt, const char* pName, const S
|
||||||
if (NULL == pSlot) {
|
if (NULL == pSlot) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(pSlot->name, pName);
|
snprintf(pSlot->name, sizeof(pSlot->name), "%s", pName);
|
||||||
pSlot->slotId = slotId;
|
pSlot->slotId = slotId;
|
||||||
pSlot->dataType = ((SExprNode*)pNode)->resType;
|
pSlot->dataType = ((SExprNode*)pNode)->resType;
|
||||||
pSlot->reserve = reserve;
|
pSlot->reserve = reserve;
|
||||||
|
@ -663,13 +663,17 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
|
||||||
code = addDataBlockSlots(pCxt, pJoin->pTargets, pJoin->node.pOutputDataBlockDesc);
|
code = addDataBlockSlots(pCxt, pJoin->pTargets, pJoin->node.pOutputDataBlockDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
SNodeList* condCols = nodesMakeList();
|
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOnConditions) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOnConditions) {
|
||||||
code = nodesCollectColumnsFromNode(pJoinLogicNode->pOnConditions, NULL, COLLECT_COL_TYPE_ALL, &condCols);
|
SNodeList* pCondCols = nodesMakeList();
|
||||||
|
if (NULL == pCondCols) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
} else {
|
||||||
|
code = nodesCollectColumnsFromNode(pJoinLogicNode->pOnConditions, NULL, COLLECT_COL_TYPE_ALL, &pCondCols);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = addDataBlockSlots(pCxt, condCols, pJoin->node.pOutputDataBlockDesc);
|
code = addDataBlockSlots(pCxt, pCondCols, pJoin->node.pOutputDataBlockDesc);
|
||||||
nodesDestroyList(condCols);
|
}
|
||||||
|
nodesDestroyList(pCondCols);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOnConditions) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOnConditions) {
|
||||||
|
@ -1634,7 +1638,7 @@ static SSubplan* makeSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubpl
|
||||||
pSubplan->subplanType = pLogicSubplan->subplanType;
|
pSubplan->subplanType = pLogicSubplan->subplanType;
|
||||||
pSubplan->level = pLogicSubplan->level;
|
pSubplan->level = pLogicSubplan->level;
|
||||||
if (NULL != pCxt->pPlanCxt->pUser) {
|
if (NULL != pCxt->pPlanCxt->pUser) {
|
||||||
strcpy(pSubplan->user, pCxt->pPlanCxt->pUser);
|
snprintf(pSubplan->user, sizeof(pSubplan->user), "%s", pCxt->pPlanCxt->pUser);
|
||||||
}
|
}
|
||||||
return pSubplan;
|
return pSubplan;
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1829,7 @@ static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNode* pSubplan, int32_t lev
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nodesListStrictAppend(pGroup->pNodeList, (SNode*)pSubplan);
|
return nodesListAppend(pGroup->pNodeList, (SNode*)pSubplan);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SSubplan* pParent,
|
static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SSubplan* pParent,
|
||||||
|
|
|
@ -342,7 +342,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strcpy(pWStart->functionName, "_wstart");
|
strcpy(pWStart->functionName, "_wstart");
|
||||||
snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart);
|
snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, (void*)pWStart);
|
||||||
int32_t code = fmGetFuncInfo(pWStart, NULL, 0);
|
int32_t code = fmGetFuncInfo(pWStart, NULL, 0);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = nodesListStrictAppend(pFuncs, (SNode*)pWStart);
|
code = nodesListStrictAppend(pFuncs, (SNode*)pWStart);
|
||||||
|
@ -367,7 +367,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
strcpy(pWEnd->functionName, "_wend");
|
strcpy(pWEnd->functionName, "_wend");
|
||||||
snprintf(pWEnd->node.aliasName, sizeof(pWEnd->node.aliasName), "%s.%p", pWEnd->functionName, pWEnd);
|
snprintf(pWEnd->node.aliasName, sizeof(pWEnd->node.aliasName), "%s.%p", pWEnd->functionName, (void*)pWEnd);
|
||||||
int32_t code = fmGetFuncInfo(pWEnd, NULL, 0);
|
int32_t code = fmGetFuncInfo(pWEnd, NULL, 0);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = nodesListStrictAppend(pWin->pFuncs, (SNode*)pWEnd);
|
code = nodesListStrictAppend(pWin->pFuncs, (SNode*)pWEnd);
|
||||||
|
@ -389,22 +389,19 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic
|
||||||
SNode* pConditions = pMergeWindow->node.pConditions;
|
SNode* pConditions = pMergeWindow->node.pConditions;
|
||||||
pMergeWindow->node.pConditions = NULL;
|
pMergeWindow->node.pConditions = NULL;
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
|
||||||
SWindowLogicNode* pPartWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow);
|
SWindowLogicNode* pPartWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow);
|
||||||
if (NULL == pPartWin) {
|
if (NULL == pPartWin) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPartWin->node.groupAction = GROUP_ACTION_KEEP;
|
pPartWin->node.groupAction = GROUP_ACTION_KEEP;
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
pMergeWindow->node.pTargets = pTargets;
|
pMergeWindow->node.pTargets = pTargets;
|
||||||
pMergeWindow->node.pConditions = pConditions;
|
pMergeWindow->node.pConditions = pConditions;
|
||||||
pPartWin->node.pChildren = pChildren;
|
pPartWin->node.pChildren = pChildren;
|
||||||
splSetParent((SLogicNode*)pPartWin);
|
splSetParent((SLogicNode*)pPartWin);
|
||||||
code = stbSplRewriteFuns(pFunc, &pPartWin->pFuncs, &pMergeWindow->pFuncs);
|
|
||||||
}
|
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
int32_t code = stbSplRewriteFuns(pFunc, &pPartWin->pFuncs, &pMergeWindow->pFuncs);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = stbSplAppendWStart(pPartWin->pFuncs, &index);
|
code = stbSplAppendWStart(pPartWin->pFuncs, &index);
|
||||||
}
|
}
|
||||||
|
@ -721,15 +718,16 @@ static int32_t stbSplCreatePartAggNode(SAggLogicNode* pMergeAgg, SLogicNode** pO
|
||||||
SNode* pConditions = pMergeAgg->node.pConditions;
|
SNode* pConditions = pMergeAgg->node.pConditions;
|
||||||
pMergeAgg->node.pConditions = NULL;
|
pMergeAgg->node.pConditions = NULL;
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
|
||||||
SAggLogicNode* pPartAgg = (SAggLogicNode*)nodesCloneNode((SNode*)pMergeAgg);
|
SAggLogicNode* pPartAgg = (SAggLogicNode*)nodesCloneNode((SNode*)pMergeAgg);
|
||||||
if (NULL == pPartAgg) {
|
if (NULL == pPartAgg) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPartAgg->node.groupAction = GROUP_ACTION_KEEP;
|
pPartAgg->node.groupAction = GROUP_ACTION_KEEP;
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pGroupKeys) {
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
if (NULL != pGroupKeys) {
|
||||||
pPartAgg->pGroupKeys = pGroupKeys;
|
pPartAgg->pGroupKeys = pGroupKeys;
|
||||||
code = createColumnByRewriteExprs(pPartAgg->pGroupKeys, &pPartAgg->node.pTargets);
|
code = createColumnByRewriteExprs(pPartAgg->pGroupKeys, &pPartAgg->node.pTargets);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue