add disk usage
This commit is contained in:
parent
6e6f353328
commit
5b82c81c82
|
@ -59,6 +59,7 @@ extern "C" {
|
||||||
#define TSDB_INS_TABLE_MACHINES "ins_machines"
|
#define TSDB_INS_TABLE_MACHINES "ins_machines"
|
||||||
#define TSDB_INS_TABLE_ENCRYPTIONS "ins_encryptions"
|
#define TSDB_INS_TABLE_ENCRYPTIONS "ins_encryptions"
|
||||||
#define TSDB_INS_TABLE_TSMAS "ins_tsmas"
|
#define TSDB_INS_TABLE_TSMAS "ins_tsmas"
|
||||||
|
#define TSDB_INS_TABLE_USAGE "ins_usage"
|
||||||
|
|
||||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||||
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
||||||
|
|
|
@ -159,6 +159,7 @@ typedef enum _mgmt_table {
|
||||||
TSDB_MGMT_TABLE_ARBGROUP,
|
TSDB_MGMT_TABLE_ARBGROUP,
|
||||||
TSDB_MGMT_TABLE_ENCRYPTIONS,
|
TSDB_MGMT_TABLE_ENCRYPTIONS,
|
||||||
TSDB_MGMT_TABLE_USER_FULL,
|
TSDB_MGMT_TABLE_USER_FULL,
|
||||||
|
TSDB_MGMT_TABLE_USAGE,
|
||||||
TSDB_MGMT_TABLE_MAX,
|
TSDB_MGMT_TABLE_MAX,
|
||||||
} EShowType;
|
} EShowType;
|
||||||
|
|
||||||
|
@ -389,6 +390,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_CREATE_TSMA_STMT,
|
QUERY_NODE_CREATE_TSMA_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
|
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
|
||||||
QUERY_NODE_DROP_TSMA_STMT,
|
QUERY_NODE_DROP_TSMA_STMT,
|
||||||
|
QUERY_NODE_SHOW_USAGE_STMT,
|
||||||
|
|
||||||
// logic plan node
|
// logic plan node
|
||||||
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
|
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
|
||||||
|
|
|
@ -432,6 +432,19 @@ static const SSysDbTableSchema encryptionsSchema[] = {
|
||||||
{.name = "key_status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "key_status", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const SSysDbTableSchema usageSchema[] = {
|
||||||
|
{.name = "db_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
||||||
|
{.name = "wal_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "memtable_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "level1_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "level2_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "level3_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "s3_size",.bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "estimated_row_data_size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
{.name = "total size", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT, .sysInfo = true},
|
||||||
|
};
|
||||||
|
|
||||||
static const SSysTableMeta infosMeta[] = {
|
static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
||||||
|
@ -468,6 +481,7 @@ static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_ARBGROUPS, arbGroupsSchema, tListLen(arbGroupsSchema), true},
|
{TSDB_INS_TABLE_ARBGROUPS, arbGroupsSchema, tListLen(arbGroupsSchema), true},
|
||||||
{TSDB_INS_TABLE_ENCRYPTIONS, encryptionsSchema, tListLen(encryptionsSchema), true},
|
{TSDB_INS_TABLE_ENCRYPTIONS, encryptionsSchema, tListLen(encryptionsSchema), true},
|
||||||
{TSDB_INS_TABLE_TSMAS, tsmaSchema, tListLen(tsmaSchema), false},
|
{TSDB_INS_TABLE_TSMAS, tsmaSchema, tListLen(tsmaSchema), false},
|
||||||
|
{TSDB_INS_TABLE_USAGE, usageSchema, tListLen(usageSchema), false},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema connectionsSchema[] = {
|
static const SSysDbTableSchema connectionsSchema[] = {
|
||||||
|
@ -482,16 +496,16 @@ static const SSysDbTableSchema connectionsSchema[] = {
|
||||||
|
|
||||||
|
|
||||||
static const SSysDbTableSchema consumerSchema[] = {
|
static const SSysDbTableSchema consumerSchema[] = {
|
||||||
{.name = "consumer_id", .bytes = TSDB_CONSUMER_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "consumer_id", .bytes = 32, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
{.name = "consumer_group", .bytes = TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "consumer_group", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
{.name = "client_id", .bytes = TSDB_CLIENT_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "client_id", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
{.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "status", .bytes = 20 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
{.name = "topics", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "topics", .bytes = TSDB_TOPIC_FNAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
/*{.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},*/
|
/*{.name = "end_point", .bytes = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},*/
|
||||||
{.name = "up_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
{.name = "up_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
||||||
{.name = "subscribe_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
{.name = "subscribe_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
||||||
{.name = "rebalance_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
{.name = "rebalance_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
|
||||||
{.name = "parameters", .bytes = 128 + TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
{.name = "parameters", .bytes = 64 + TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema offsetSchema[] = {
|
static const SSysDbTableSchema offsetSchema[] = {
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndPrivilege.h"
|
#include "mndPrivilege.h"
|
||||||
#include "systable.h"
|
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
#include "systable.h"
|
||||||
|
|
||||||
#define SHOW_STEP_SIZE 100
|
#define SHOW_STEP_SIZE 100
|
||||||
#define SHOW_COLS_STEP_SIZE 4096
|
#define SHOW_COLS_STEP_SIZE 4096
|
||||||
|
@ -138,6 +138,8 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
|
||||||
type = TSDB_MGMT_TABLE_ENCRYPTIONS;
|
type = TSDB_MGMT_TABLE_ENCRYPTIONS;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_TSMAS, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_TSMAS, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_TSMAS;
|
type = TSDB_MGMT_TABLE_TSMAS;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USAGE, len) == 0) {
|
||||||
|
type = TSDB_MGMT_TABLE_USAGE;
|
||||||
} else {
|
} else {
|
||||||
mError("invalid show name:%s len:%d", name, len);
|
mError("invalid show name:%s len:%d", name, len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,8 +902,7 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
|
||||||
if (isDeleteStmt(pCurrStmt)) {
|
if (isDeleteStmt(pCurrStmt)) {
|
||||||
return ((SDeleteStmt*)pCurrStmt)->precision;
|
return ((SDeleteStmt*)pCurrStmt)->precision;
|
||||||
}
|
}
|
||||||
if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT)
|
if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT) return ((SCreateTSMAStmt*)pCurrStmt)->precision;
|
||||||
return ((SCreateTSMAStmt*)pCurrStmt)->precision;
|
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,8 +1068,7 @@ int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) *ppOut = pPartitionList;
|
||||||
*ppOut = pPartitionList;
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1102,8 @@ static int32_t isTimeLineAlignedQuery(SNode* pStmt, bool* pRes) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
if (TSDB_CODE_SUCCESS == code &&
|
||||||
|
QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
||||||
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
||||||
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
||||||
SNodeList* pPartitionList = NULL;
|
SNodeList* pPartitionList = NULL;
|
||||||
|
@ -1472,7 +1471,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*pFound) {
|
if (*pFound) {
|
||||||
if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) {
|
if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) &&
|
||||||
|
(SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) {
|
||||||
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
||||||
|
@ -1612,8 +1612,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(pFunc->functionName, NULL, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(pFunc->functionName, NULL, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
|
@ -1629,8 +1628,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(pFunc->functionName, pTableAlias, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(pFunc->functionName, pTableAlias, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
nodesListInsertListAfterPos(pSelect->pProjectionList, pSelectListCell, pTbnameNodeList);
|
nodesListInsertListAfterPos(pSelect->pProjectionList, pSelectListCell, pTbnameNodeList);
|
||||||
|
@ -1662,8 +1660,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(NULL, NULL, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(NULL, NULL, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
|
@ -1678,8 +1675,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
((SRealTableNode*)pTable)->pMeta != NULL && ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta != NULL && ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(NULL, pTableAlias, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(NULL, pTableAlias, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS ==code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
nodesListInsertListAfterPos(pSelect->pProjectionList, cell, pTbnameNodeList);
|
nodesListInsertListAfterPos(pSelect->pProjectionList, cell, pTbnameNodeList);
|
||||||
|
@ -1745,9 +1741,7 @@ int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* p
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool clauseSupportAlias(ESqlClause clause) {
|
static bool clauseSupportAlias(ESqlClause clause) {
|
||||||
return SQL_CLAUSE_GROUP_BY == clause ||
|
return SQL_CLAUSE_GROUP_BY == clause || SQL_CLAUSE_PARTITION_BY == clause || SQL_CLAUSE_ORDER_BY == clause;
|
||||||
SQL_CLAUSE_PARTITION_BY == clause ||
|
|
||||||
SQL_CLAUSE_ORDER_BY == clause;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
|
@ -1776,8 +1770,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
res = translateColumnWithPrefix(pCxt, pCol);
|
res = translateColumnWithPrefix(pCxt, pCol);
|
||||||
} else {
|
} else {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if ((clauseSupportAlias(pCxt->currClause)) &&
|
if ((clauseSupportAlias(pCxt->currClause)) && !(*pCol)->node.asParam) {
|
||||||
!(*pCol)->node.asParam) {
|
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
}
|
}
|
||||||
if (DEAL_RES_ERROR != res && !found) {
|
if (DEAL_RES_ERROR != res && !found) {
|
||||||
|
@ -1787,9 +1780,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
res = translateColumnWithoutPrefix(pCxt, pCol);
|
res = translateColumnWithoutPrefix(pCxt, pCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clauseSupportAlias(pCxt->currClause) &&
|
if (clauseSupportAlias(pCxt->currClause) && !(*pCol)->node.asParam && res != DEAL_RES_CONTINUE &&
|
||||||
!(*pCol)->node.asParam &&
|
|
||||||
res != DEAL_RES_CONTINUE &&
|
|
||||||
res != DEAL_RES_END) {
|
res != DEAL_RES_END) {
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
}
|
}
|
||||||
|
@ -2992,8 +2983,7 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc
|
||||||
|
|
||||||
pCxt->errCode = getFuncInfo(pCxt, *pFunc);
|
pCxt->errCode = getFuncInfo(pCxt, *pFunc);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause ||
|
if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause) &&
|
||||||
SQL_CLAUSE_PARTITION_BY == pCxt->currClause) &&
|
|
||||||
fmIsVectorFunc((*pFunc)->funcId)) {
|
fmIsVectorFunc((*pFunc)->funcId)) {
|
||||||
pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION;
|
pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION;
|
||||||
}
|
}
|
||||||
|
@ -4671,8 +4661,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
|
||||||
}
|
}
|
||||||
code = translateAudit(pCxt, pRealTable, &name);
|
code = translateAudit(pCxt, pRealTable, &name);
|
||||||
#endif
|
#endif
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = setTableVgroupList(pCxt, &name, pRealTable);
|
||||||
code = setTableVgroupList(pCxt, &name, pRealTable);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setTableIndex(pCxt, &name, pRealTable);
|
code = setTableIndex(pCxt, &name, pRealTable);
|
||||||
}
|
}
|
||||||
|
@ -5064,8 +5053,8 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
|
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
|
||||||
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType
|
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType &&
|
||||||
&& FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) {
|
FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) {
|
||||||
*(bool*)pContext = true;
|
*(bool*)pContext = true;
|
||||||
return DEAL_RES_END;
|
return DEAL_RES_END;
|
||||||
}
|
}
|
||||||
|
@ -5220,8 +5209,7 @@ static int32_t replaceGroupByAlias(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
if (NULL == pSelect->pGroupByList) {
|
if (NULL == pSelect->pGroupByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -5231,8 +5219,7 @@ static int32_t replacePartitionByAlias(STranslateContext* pCxt, SSelectStmt* pSe
|
||||||
if (NULL == pSelect->pPartitionByList) {
|
if (NULL == pSelect->pPartitionByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -6021,7 +6008,8 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo, bool* pRet) {
|
static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo,
|
||||||
|
bool* pRet) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
char* pTableAlias = NULL;
|
char* pTableAlias = NULL;
|
||||||
char* pTbNameVal = NULL;
|
char* pTbNameVal = NULL;
|
||||||
|
@ -6347,8 +6335,8 @@ static EDealRes collectTableAlias(SNode* pNode, void* pContext) {
|
||||||
*(SSHashObj**)pContext = pHash;
|
*(SSHashObj**)pContext = pHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias), pCol->tableAlias,
|
if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias),
|
||||||
sizeof(pCol->tableAlias))) {
|
pCol->tableAlias, sizeof(pCol->tableAlias))) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6614,8 +6602,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = resetSelectFuncNumWithoutDup(pSelect);
|
code = resetSelectFuncNumWithoutDup(pSelect);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = checkAggColCoexist(pCxt, pSelect);
|
||||||
code = checkAggColCoexist(pCxt, pSelect);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -8533,7 +8520,8 @@ static int32_t createRollupFuncs(SCreateTableStmt* pStmt, SNodeList** ppList) {
|
||||||
}
|
}
|
||||||
*ppList = pFuncs;
|
*ppList = pFuncs;
|
||||||
|
|
||||||
return code;;
|
return code;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, STableMeta** ppTbMeta) {
|
static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, STableMeta** ppTbMeta) {
|
||||||
|
@ -8656,8 +8644,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
||||||
// columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
// columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||||
// columnDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
// columnDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||||
code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
||||||
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||||
|
@ -8674,10 +8661,10 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs);
|
pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs);
|
||||||
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name);
|
code =
|
||||||
|
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = collectUseTable(&tableName, pCxt->pTables);
|
||||||
code = collectUseTable(&tableName, pCxt->pTables);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = collectUseTable(&tableName, pCxt->pTargetTables);
|
code = collectUseTable(&tableName, pCxt->pTargetTables);
|
||||||
}
|
}
|
||||||
|
@ -8730,7 +8717,8 @@ static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableS
|
||||||
|
|
||||||
static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, SMAlterStbReq* pAlterReq) {
|
static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, SMAlterStbReq* pAlterReq) {
|
||||||
SName tableName;
|
SName tableName;
|
||||||
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pAlterReq->name);
|
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName),
|
||||||
|
pAlterReq->name);
|
||||||
if (TSDB_CODE_SUCCESS != code) return code;
|
if (TSDB_CODE_SUCCESS != code) return code;
|
||||||
pAlterReq->alterType = pStmt->alterType;
|
pAlterReq->alterType = pStmt->alterType;
|
||||||
|
|
||||||
|
@ -9033,7 +9021,8 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p
|
||||||
code = tNameExtractFullName(&name, usedbReq.db);
|
code = tNameExtractFullName(&name, usedbReq.db);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code)
|
||||||
code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs);
|
code =
|
||||||
|
getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq);
|
code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq);
|
||||||
}
|
}
|
||||||
|
@ -9246,7 +9235,8 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt,
|
||||||
|
|
||||||
static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) {
|
static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) {
|
||||||
SName name;
|
SName name;
|
||||||
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->name);
|
int32_t code =
|
||||||
|
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->name);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
memset(&name, 0, sizeof(SName));
|
memset(&name, 0, sizeof(SName));
|
||||||
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb);
|
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb);
|
||||||
|
@ -9397,7 +9387,8 @@ static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt*
|
||||||
|
|
||||||
static int32_t buildCreateTagIndexReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SCreateTagIndexReq* pReq) {
|
static int32_t buildCreateTagIndexReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SCreateTagIndexReq* pReq) {
|
||||||
SName name;
|
SName name;
|
||||||
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->idxName);
|
int32_t code =
|
||||||
|
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->idxName);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
memset(&name, 0, sizeof(SName));
|
memset(&name, 0, sizeof(SName));
|
||||||
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stbName);
|
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stbName);
|
||||||
|
@ -9477,7 +9468,8 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p
|
||||||
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {
|
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {
|
||||||
SMDropSmaReq dropSmaReq = {0};
|
SMDropSmaReq dropSmaReq = {0};
|
||||||
SName name;
|
SName name;
|
||||||
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), dropSmaReq.name);
|
int32_t code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name),
|
||||||
|
dropSmaReq.name);
|
||||||
if (TSDB_CODE_SUCCESS != code) return code;
|
if (TSDB_CODE_SUCCESS != code) return code;
|
||||||
dropSmaReq.igNotExists = pStmt->ignoreNotExists;
|
dropSmaReq.igNotExists = pStmt->ignoreNotExists;
|
||||||
return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq);
|
return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq);
|
||||||
|
@ -9563,8 +9555,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
|
||||||
} else if ('\0' != pStmt->subDbName[0]) {
|
} else if ('\0' != pStmt->subDbName[0]) {
|
||||||
pReq->subType = TOPIC_SUB_TYPE__DB;
|
pReq->subType = TOPIC_SUB_TYPE__DB;
|
||||||
code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->subDbName, strlen(pStmt->subDbName));
|
code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->subDbName, strlen(pStmt->subDbName));
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) (void)tNameGetFullDbName(&name, pReq->subDbName);
|
||||||
(void)tNameGetFullDbName(&name, pReq->subDbName);
|
|
||||||
} else {
|
} else {
|
||||||
pReq->subType = TOPIC_SUB_TYPE__COLUMN;
|
pReq->subType = TOPIC_SUB_TYPE__COLUMN;
|
||||||
char* dbName = ((SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable))->table.dbName;
|
char* dbName = ((SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable))->table.dbName;
|
||||||
|
@ -10076,8 +10067,7 @@ static int32_t addNullTagsForExistTable(STranslateContext* pCxt, STableMeta* pMe
|
||||||
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) {
|
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) {
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pSelect->pTags, pNull);
|
||||||
code = nodesListMakeStrictAppend(&pSelect->pTags, pNull);
|
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -10137,8 +10127,7 @@ static int32_t addNullTagsForCreateTable(STranslateContext* pCxt, SCreateStreamS
|
||||||
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) {
|
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) {
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull);
|
||||||
code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull);
|
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -10599,8 +10588,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons
|
||||||
}
|
}
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pNewTagExprs, pNull);
|
||||||
code = nodesListStrictAppend(pNewTagExprs, pNull);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11501,8 +11489,7 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
|
||||||
SName name;
|
SName name;
|
||||||
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||||
(void)tNameGetFullDbName(&name, pStmt->dbFName);
|
(void)tNameGetFullDbName(&name, pStmt->dbFName);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
||||||
return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11642,8 +11629,7 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC
|
||||||
info.pDbName = pStmt->dbName;
|
info.pDbName = pStmt->dbName;
|
||||||
info.pTableName = tbName;
|
info.pTableName = tbName;
|
||||||
code = nodesCloneList(pStmt->pOptions->pFuncs, &info.pFuncs);
|
code = nodesCloneList(pStmt->pOptions->pFuncs, &info.pFuncs);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval);
|
||||||
code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval);
|
|
||||||
|
|
||||||
SFunctionNode* pTbnameFunc = NULL;
|
SFunctionNode* pTbnameFunc = NULL;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -11670,8 +11656,7 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
SNode* pNew = NULL;
|
SNode* pNew = NULL;
|
||||||
code = nodesCloneNode(pTagCol, &pNew);
|
code = nodesCloneNode(pTagCol, &pNew);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&info.pTags, pNew);
|
||||||
code = nodesListMakeStrictAppend(&info.pTags, pNew);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11828,8 +11813,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
|
||||||
} else {
|
} else {
|
||||||
if (pReq->intervalUnit == TIME_UNIT_MONTH && (pReq->interval < 1 || pReq->interval > 12))
|
if (pReq->intervalUnit == TIME_UNIT_MONTH && (pReq->interval < 1 || pReq->interval > 12))
|
||||||
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
||||||
if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1))
|
if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1)) return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
||||||
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
|
@ -11872,7 +11856,8 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
memset(useTbName, 0, sizeof(SName));
|
memset(useTbName, 0, sizeof(SName));
|
||||||
memcpy(pStmt->originalTbName, pRecursiveTsma->tb, TSDB_TABLE_NAME_LEN);
|
memcpy(pStmt->originalTbName, pRecursiveTsma->tb, TSDB_TABLE_NAME_LEN);
|
||||||
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pRecursiveTsma->tb, useTbName), pReq->stb);
|
code = tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pRecursiveTsma->tb, useTbName),
|
||||||
|
pReq->stb);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
numOfCols = pRecursiveTsma->pUsedCols->size;
|
numOfCols = pRecursiveTsma->pUsedCols->size;
|
||||||
|
@ -12728,11 +12713,9 @@ static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) {
|
||||||
}
|
}
|
||||||
nodesDestroyNode((SNode*)pValNode2);
|
nodesDestroyNode((SNode*)pValNode2);
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND);
|
||||||
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
||||||
code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pNameCond1);
|
nodesDestroyNode(pNameCond1);
|
||||||
|
@ -12764,8 +12747,7 @@ static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) {
|
||||||
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR);
|
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
||||||
code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pNameCond1);
|
nodesDestroyNode(pNameCond1);
|
||||||
|
@ -12781,8 +12763,7 @@ static int32_t addShowNormalTablesCond(SSelectStmt* pSelect) {
|
||||||
SValueNode* pValNode1 = NULL;
|
SValueNode* pValNode1 = NULL;
|
||||||
code = nodesMakeValueNodeFromString("NORMAL_TABLE", &pValNode1);
|
code = nodesMakeValueNodeFromString("NORMAL_TABLE", &pValNode1);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
|
||||||
|
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
|
|
||||||
|
@ -12797,8 +12778,7 @@ static int32_t addShowChildTablesCond(SSelectStmt* pSelect) {
|
||||||
SValueNode* pValNode1 = NULL;
|
SValueNode* pValNode1 = NULL;
|
||||||
code = nodesMakeValueNodeFromString("CHILD_TABLE", &pValNode1);
|
code = nodesMakeValueNodeFromString("CHILD_TABLE", &pValNode1);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
|
||||||
|
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
|
|
||||||
|
@ -13063,8 +13043,7 @@ static int32_t rewriteShowTableDist(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
NODES_DESTORY_LIST(pStmt->pProjectionList);
|
NODES_DESTORY_LIST(pStmt->pProjectionList);
|
||||||
SFunctionNode* pFuncNew = NULL;
|
SFunctionNode* pFuncNew = NULL;
|
||||||
code = createBlockDistFunc(&pFuncNew);
|
code = createBlockDistFunc(&pFuncNew);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew);
|
||||||
code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pCxt->showRewrite = true;
|
pCxt->showRewrite = true;
|
||||||
|
@ -14937,12 +14916,9 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
SNode* pCond3 = NULL;
|
SNode* pCond3 = NULL;
|
||||||
SNode* pCond4 = NULL;
|
SNode* pCond4 = NULL;
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1);
|
code = createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2);
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3);
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4);
|
|
||||||
nodesDestroyNode((SNode*)pValNode);
|
nodesDestroyNode((SNode*)pValNode);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pCond1);
|
nodesDestroyNode(pCond1);
|
||||||
|
@ -14957,10 +14933,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
SNode* pTemp2 = NULL;
|
SNode* pTemp2 = NULL;
|
||||||
SNode* pFullCond = NULL;
|
SNode* pFullCond = NULL;
|
||||||
code = createLogicCondNode(&pCond1, &pCond2, &pTemp1, LOGIC_COND_TYPE_OR);
|
code = createLogicCondNode(&pCond1, &pCond2, &pTemp1, LOGIC_COND_TYPE_OR);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR);
|
||||||
code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR);
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
|
||||||
code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR);
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pCond1);
|
nodesDestroyNode(pCond1);
|
||||||
nodesDestroyNode(pCond2);
|
nodesDestroyNode(pCond2);
|
||||||
|
@ -15354,6 +15328,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
|
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
|
||||||
case QUERY_NODE_SHOW_ENCRYPTIONS_STMT:
|
case QUERY_NODE_SHOW_ENCRYPTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_TSMAS_STMT:
|
case QUERY_NODE_SHOW_TSMAS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_USAGE_STMT:
|
||||||
code = rewriteShow(pCxt, pQuery);
|
code = rewriteShow(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_SHOW_TAGS_STMT:
|
case QUERY_NODE_SHOW_TAGS_STMT:
|
||||||
|
|
Loading…
Reference in New Issue