Merge pull request #14033 from taosdata/feature/3.0_debug_wxy
feat: sql command 'show local variables' and 'show dnode variables'
This commit is contained in:
commit
aca91eb831
|
@ -41,6 +41,7 @@ extern "C" {
|
||||||
#define TSDB_INS_TABLE_VGROUPS "vgroups"
|
#define TSDB_INS_TABLE_VGROUPS "vgroups"
|
||||||
#define TSDB_INS_TABLE_VNODES "vnodes"
|
#define TSDB_INS_TABLE_VNODES "vnodes"
|
||||||
#define TSDB_INS_TABLE_CONFIGS "configs"
|
#define TSDB_INS_TABLE_CONFIGS "configs"
|
||||||
|
#define TSDB_INS_TABLE_DNODE_VARIABLES "dnode_variables"
|
||||||
|
|
||||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||||
#define TSDB_PERFS_TABLE_SMAS "smas"
|
#define TSDB_PERFS_TABLE_SMAS "smas"
|
||||||
|
|
|
@ -2282,6 +2282,9 @@ typedef struct {
|
||||||
int8_t igNotExists;
|
int8_t igNotExists;
|
||||||
} SMDropStreamReq;
|
} SMDropStreamReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSMDropStreamReq(void* buf, int32_t bufLen, const SMDropStreamReq* pReq);
|
||||||
|
int32_t tDeserializeSMDropStreamReq(void* buf, int32_t bufLen, SMDropStreamReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t reserved;
|
int8_t reserved;
|
||||||
} SMDropStreamRsp;
|
} SMDropStreamRsp;
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef struct SCatalogReq {
|
||||||
SArray* pUser; // element is SUserAuthInfo
|
SArray* pUser; // element is SUserAuthInfo
|
||||||
SArray* pTableIndex; // element is SNAME
|
SArray* pTableIndex; // element is SNAME
|
||||||
bool qNodeRequired; // valid qnode
|
bool qNodeRequired; // valid qnode
|
||||||
|
bool dNodeRequired; // valid dnode
|
||||||
bool forceUpdate;
|
bool forceUpdate;
|
||||||
} SCatalogReq;
|
} SCatalogReq;
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ typedef struct SMetaData {
|
||||||
SArray* pIndex; // pRes = SIndexInfo*
|
SArray* pIndex; // pRes = SIndexInfo*
|
||||||
SArray* pUser; // pRes = bool*
|
SArray* pUser; // pRes = bool*
|
||||||
SArray* pQnodeList; // pRes = SArray<SQueryNodeLoad>*
|
SArray* pQnodeList; // pRes = SArray<SQueryNodeLoad>*
|
||||||
|
SArray* pDnodeList; // pRes = SArray<SEpSet>*
|
||||||
} SMetaData;
|
} SMetaData;
|
||||||
|
|
||||||
typedef struct SCatalogCfg {
|
typedef struct SCatalogCfg {
|
||||||
|
@ -268,6 +270,8 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, uint64_t
|
||||||
|
|
||||||
int32_t catalogGetQnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray* pQnodeList);
|
int32_t catalogGetQnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray* pQnodeList);
|
||||||
|
|
||||||
|
int32_t catalogGetDnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray** pDnodeList);
|
||||||
|
|
||||||
int32_t catalogGetExpiredSTables(SCatalog* pCatalog, SSTableVersion **stables, uint32_t *num);
|
int32_t catalogGetExpiredSTables(SCatalog* pCatalog, SSTableVersion **stables, uint32_t *num);
|
||||||
|
|
||||||
int32_t catalogGetExpiredDBs(SCatalog* pCatalog, SDbVgVersion** dbs, uint32_t* num);
|
int32_t catalogGetExpiredDBs(SCatalog* pCatalog, SDbVgVersion** dbs, uint32_t* num);
|
||||||
|
|
|
@ -230,6 +230,11 @@ typedef struct SShowTableDistributedStmt {
|
||||||
char tableName[TSDB_TABLE_NAME_LEN];
|
char tableName[TSDB_TABLE_NAME_LEN];
|
||||||
} SShowTableDistributedStmt;
|
} SShowTableDistributedStmt;
|
||||||
|
|
||||||
|
typedef struct SShowDnodeVariablesStmt {
|
||||||
|
ENodeType type;
|
||||||
|
SNode* pDnodeId;
|
||||||
|
} SShowDnodeVariablesStmt;
|
||||||
|
|
||||||
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT } EIndexType;
|
||||||
|
|
||||||
typedef struct SIndexOptions {
|
typedef struct SIndexOptions {
|
||||||
|
|
|
@ -180,7 +180,9 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_SHOW_VNODES_STMT,
|
QUERY_NODE_SHOW_VNODES_STMT,
|
||||||
QUERY_NODE_SHOW_APPS_STMT,
|
QUERY_NODE_SHOW_APPS_STMT,
|
||||||
QUERY_NODE_SHOW_SCORES_STMT,
|
QUERY_NODE_SHOW_SCORES_STMT,
|
||||||
QUERY_NODE_SHOW_VARIABLE_STMT,
|
QUERY_NODE_SHOW_VARIABLES_STMT,
|
||||||
|
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT,
|
||||||
|
QUERY_NODE_SHOW_DNODE_VARIABLES_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
|
QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
|
QUERY_NODE_SHOW_CREATE_TABLE_STMT,
|
||||||
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
|
QUERY_NODE_SHOW_CREATE_STABLE_STMT,
|
||||||
|
|
|
@ -4267,6 +4267,35 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tSerializeSMDropStreamReq(void *buf, int32_t bufLen, const SMDropStreamReq *pReq) {
|
||||||
|
SEncoder encoder = {0};
|
||||||
|
tEncoderInit(&encoder, buf, bufLen);
|
||||||
|
|
||||||
|
if (tStartEncode(&encoder) < 0) return -1;
|
||||||
|
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||||
|
if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
||||||
|
|
||||||
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
|
int32_t tlen = encoder.pos;
|
||||||
|
tEncoderClear(&encoder);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tDeserializeSMDropStreamReq(void *buf, int32_t bufLen, SMDropStreamReq *pReq) {
|
||||||
|
SDecoder decoder = {0};
|
||||||
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
|
if (tStartDecode(&decoder) < 0) return -1;
|
||||||
|
if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
||||||
|
if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
|
||||||
|
|
||||||
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
|
tDecoderClear(&decoder);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
|
void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) {
|
||||||
taosMemoryFreeClear(pReq->sql);
|
taosMemoryFreeClear(pReq->sql);
|
||||||
taosMemoryFreeClear(pReq->ast);
|
taosMemoryFreeClear(pReq->ast);
|
||||||
|
|
|
@ -1121,6 +1121,10 @@ _return:
|
||||||
CTG_API_LEAVE(TSDB_CODE_SUCCESS);
|
CTG_API_LEAVE(TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t catalogGetDnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray** pDnodeList) {
|
||||||
|
return TSDB_CODE_CTG_INVALID_INPUT;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t catalogGetExpiredSTables(SCatalog* pCtg, SSTableVersion **stables, uint32_t *num) {
|
int32_t catalogGetExpiredSTables(SCatalog* pCtg, SSTableVersion **stables, uint32_t *num) {
|
||||||
CTG_API_ENTER();
|
CTG_API_ENTER();
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt) { return TSDB_C
|
||||||
|
|
||||||
static int32_t execAlterLocal(SAlterLocalStmt* pStmt) { return TSDB_CODE_FAILED; }
|
static int32_t execAlterLocal(SAlterLocalStmt* pStmt) { return TSDB_CODE_FAILED; }
|
||||||
|
|
||||||
|
static int32_t execShowLocalVariables() { return TSDB_CODE_FAILED; }
|
||||||
|
|
||||||
int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
|
int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
|
||||||
switch (nodeType(pStmt)) {
|
switch (nodeType(pStmt)) {
|
||||||
case QUERY_NODE_DESCRIBE_STMT:
|
case QUERY_NODE_DESCRIBE_STMT:
|
||||||
|
@ -145,6 +147,8 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
|
||||||
return execShowCreateSTable((SShowCreateTableStmt*)pStmt);
|
return execShowCreateSTable((SShowCreateTableStmt*)pStmt);
|
||||||
case QUERY_NODE_ALTER_LOCAL_STMT:
|
case QUERY_NODE_ALTER_LOCAL_STMT:
|
||||||
return execAlterLocal((SAlterLocalStmt*)pStmt);
|
return execAlterLocal((SAlterLocalStmt*)pStmt);
|
||||||
|
case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT:
|
||||||
|
return execShowLocalVariables();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,9 +207,12 @@ SNode* nodesMakeNode(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_VNODES_STMT:
|
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_APPS_STMT:
|
case QUERY_NODE_SHOW_APPS_STMT:
|
||||||
case QUERY_NODE_SHOW_SCORES_STMT:
|
case QUERY_NODE_SHOW_SCORES_STMT:
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
||||||
return makeNode(type, sizeof(SShowStmt));
|
return makeNode(type, sizeof(SShowStmt));
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
|
return makeNode(type, sizeof(SShowDnodeVariablesStmt));
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||||
return makeNode(type, sizeof(SShowCreateDatabaseStmt));
|
return makeNode(type, sizeof(SShowCreateDatabaseStmt));
|
||||||
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
||||||
|
@ -637,13 +640,16 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
case QUERY_NODE_SHOW_VNODES_STMT:
|
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_APPS_STMT:
|
case QUERY_NODE_SHOW_APPS_STMT:
|
||||||
case QUERY_NODE_SHOW_SCORES_STMT:
|
case QUERY_NODE_SHOW_SCORES_STMT:
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_TRANSACTIONS_STMT: {
|
case QUERY_NODE_SHOW_TRANSACTIONS_STMT: {
|
||||||
SShowStmt* pStmt = (SShowStmt*)pNode;
|
SShowStmt* pStmt = (SShowStmt*)pNode;
|
||||||
nodesDestroyNode(pStmt->pDbName);
|
nodesDestroyNode(pStmt->pDbName);
|
||||||
nodesDestroyNode(pStmt->pTbName);
|
nodesDestroyNode(pStmt->pTbName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: // no pointer field
|
||||||
|
break;
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||||
taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg);
|
taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -161,6 +161,7 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD
|
||||||
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable);
|
||||||
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
|
SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable);
|
||||||
|
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId);
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword);
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword);
|
||||||
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
|
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
|
||||||
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
|
||||||
|
|
|
@ -47,6 +47,8 @@ typedef struct SParseMetaCache {
|
||||||
SHashObj* pUserAuth; // key is SUserAuthInfo serialized string, element is bool indicating whether or not to pass
|
SHashObj* pUserAuth; // key is SUserAuthInfo serialized string, element is bool indicating whether or not to pass
|
||||||
SHashObj* pUdf; // key is funcName, element is SFuncInfo*
|
SHashObj* pUdf; // key is funcName, element is SFuncInfo*
|
||||||
SHashObj* pTableIndex; // key is tbFName, element is SArray<STableIndexInfo>*
|
SHashObj* pTableIndex; // key is tbFName, element is SArray<STableIndexInfo>*
|
||||||
|
SArray* pDnodes; // element is SEpSet
|
||||||
|
bool dnodeRequired;
|
||||||
} SParseMetaCache;
|
} SParseMetaCache;
|
||||||
|
|
||||||
int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...);
|
int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...);
|
||||||
|
@ -77,6 +79,7 @@ int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pD
|
||||||
int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache);
|
int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache);
|
||||||
int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache);
|
int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache);
|
||||||
int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
|
int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
|
||||||
|
int32_t reserveDnodeRequiredInCache(SParseMetaCache* pMetaCache);
|
||||||
int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta);
|
int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta);
|
||||||
int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SArray** pVgInfo);
|
int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SArray** pVgInfo);
|
||||||
int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName, SVgroupInfo* pVgroup);
|
int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName, SVgroupInfo* pVgroup);
|
||||||
|
@ -87,6 +90,7 @@ int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, con
|
||||||
bool* pPass);
|
bool* pPass);
|
||||||
int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo);
|
int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo);
|
||||||
int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, SArray** pIndexes);
|
int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, SArray** pIndexes);
|
||||||
|
int32_t getDnodeListFromCache(SParseMetaCache* pMetaCache, SArray** pDnodes);
|
||||||
void destoryParseMetaCache(SParseMetaCache* pMetaCache);
|
void destoryParseMetaCache(SParseMetaCache* pMetaCache);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -373,7 +373,9 @@ cmd ::= SHOW CREATE STABLE full_table_name(A).
|
||||||
cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
|
cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
|
||||||
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
|
cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
|
||||||
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
|
cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
|
||||||
cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT); }
|
cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
|
||||||
|
cmd ::= SHOW LOCAL VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
|
||||||
|
cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES. { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
|
||||||
cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
|
cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
|
||||||
cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
|
cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
|
||||||
cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
|
cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
|
||||||
|
|
|
@ -1197,6 +1197,14 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) {
|
||||||
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)nodesMakeNode(QUERY_NODE_SHOW_DNODE_VARIABLES_STMT);
|
||||||
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
|
pStmt->pDnodeId = pDnodeId;
|
||||||
|
return (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) {
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
||||||
|
|
|
@ -397,6 +397,15 @@ static int32_t collectMetaKeyFromShowVariables(SCollectMetaKeyCxt* pCxt, SShowSt
|
||||||
pCxt->pMetaCache);
|
pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromShowDnodeVariables(SCollectMetaKeyCxt* pCxt, SShowDnodeVariablesStmt* pStmt) {
|
||||||
|
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
TSDB_INS_TABLE_DNODE_VARIABLES, pCxt->pMetaCache);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = reserveDnodeRequiredInCache(pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) {
|
static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) {
|
||||||
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
@ -502,8 +511,10 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromShowConnections(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowConnections(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_QUERIES_STMT:
|
case QUERY_NODE_SHOW_QUERIES_STMT:
|
||||||
return collectMetaKeyFromShowQueries(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowQueries(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
return collectMetaKeyFromShowVariables(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowVariables(pCxt, (SShowStmt*)pStmt);
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
|
return collectMetaKeyFromShowDnodeVariables(pCxt, (SShowDnodeVariablesStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
|
||||||
return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt);
|
return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
||||||
|
|
|
@ -305,6 +305,24 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t getDnodeList(STranslateContext* pCxt, SArray** pDnodes) {
|
||||||
|
SParseContext* pParCxt = pCxt->pParseCxt;
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (pParCxt->async) {
|
||||||
|
code = getDnodeListFromCache(pCxt->pMetaCache, pDnodes);
|
||||||
|
} else {
|
||||||
|
SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter,
|
||||||
|
.requestId = pParCxt->requestId,
|
||||||
|
.requestObjRefId = pParCxt->requestRid,
|
||||||
|
.mgmtEps = pParCxt->mgmtEpSet};
|
||||||
|
code = catalogGetDnodeList(pParCxt->pCatalog, &conn, pDnodes);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
parserError("getDnodeList error, code:%s", tstrerror(code));
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t initTranslateContext(SParseContext* pParseCxt, SParseMetaCache* pMetaCache, STranslateContext* pCxt) {
|
static int32_t initTranslateContext(SParseContext* pParseCxt, SParseMetaCache* pMetaCache, STranslateContext* pCxt) {
|
||||||
pCxt->pParseCxt = pParseCxt;
|
pCxt->pParseCxt = pParseCxt;
|
||||||
pCxt->errCode = TSDB_CODE_SUCCESS;
|
pCxt->errCode = TSDB_CODE_SUCCESS;
|
||||||
|
@ -1450,12 +1468,27 @@ static int32_t addMnodeToVgroupList(const SEpSet* pEpSet, SArray** pVgroupList)
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
|
||||||
if (0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES) &&
|
size_t ndnode = taosArrayGetSize(pDnodes);
|
||||||
0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED)) {
|
*pVgsInfo = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo) * ndnode);
|
||||||
|
if (NULL == *pVgsInfo) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
(*pVgsInfo)->numOfVgroups = ndnode;
|
||||||
|
for (int32_t i = 0; i < ndnode; ++i) {
|
||||||
|
memcpy(&((*pVgsInfo)->vgroups[i].epSet), taosArrayGet(pDnodes, i), sizeof(SEpSet));
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool sysTableFromVnode(const char* pTable) {
|
||||||
|
return (0 == strcmp(pTable, TSDB_INS_TABLE_USER_TABLES)) ||
|
||||||
|
(0 == strcmp(pTable, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool sysTableFromDnode(const char* pTable) { return 0 == strcmp(pTable, TSDB_INS_TABLE_DNODE_VARIABLES); }
|
||||||
|
|
||||||
|
static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SArray* vgroupList = NULL;
|
SArray* vgroupList = NULL;
|
||||||
if ('\0' != pRealTable->qualDbName[0]) {
|
if ('\0' != pRealTable->qualDbName[0]) {
|
||||||
|
@ -1478,6 +1511,26 @@ static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRea
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t setDnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||||
|
SArray* pDnodes = NULL;
|
||||||
|
int32_t code = getDnodeList(pCxt, &pDnodes);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList);
|
||||||
|
}
|
||||||
|
taosArrayDestroy(pDnodes);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t setSysTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||||
|
if (sysTableFromVnode(pRealTable->table.tableName)) {
|
||||||
|
return setVnodeSysTableVgroupList(pCxt, pName, pRealTable);
|
||||||
|
} else if (sysTableFromDnode(pRealTable->table.tableName)) {
|
||||||
|
return setDnodeSysTableVgroupList(pCxt, pName, pRealTable);
|
||||||
|
} else {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t setTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
static int32_t setTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||||
if (pCxt->pParseCxt->topicQuery) {
|
if (pCxt->pParseCxt->topicQuery) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -4081,8 +4134,12 @@ static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt*
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) {
|
static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) {
|
||||||
// todo
|
SMDropStreamReq dropReq = {0};
|
||||||
return TSDB_CODE_SUCCESS;
|
SName name;
|
||||||
|
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->streamName, strlen(pStmt->streamName));
|
||||||
|
tNameGetFullDbName(&name, dropReq.name);
|
||||||
|
dropReq.igNotExists = pStmt->ignoreNotExists;
|
||||||
|
return buildCmdMsg(pCxt, TDMT_MND_DROP_STREAM, (FSerializeFunc)tSerializeSMDropStreamReq, &dropReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t readFromFile(char* pName, int32_t* len, char** buf) {
|
static int32_t readFromFile(char* pName, int32_t* len, char** buf) {
|
||||||
|
@ -4538,7 +4595,8 @@ static const char* getSysDbName(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_LICENCE_STMT:
|
case QUERY_NODE_SHOW_LICENCE_STMT:
|
||||||
case QUERY_NODE_SHOW_CLUSTER_STMT:
|
case QUERY_NODE_SHOW_CLUSTER_STMT:
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
return TSDB_INFORMATION_SCHEMA_DB;
|
return TSDB_INFORMATION_SCHEMA_DB;
|
||||||
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
|
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_QUERIES_STMT:
|
case QUERY_NODE_SHOW_QUERIES_STMT:
|
||||||
|
@ -4595,10 +4653,12 @@ static const char* getSysTableName(ENodeType type) {
|
||||||
return TSDB_PERFS_TABLE_TOPICS;
|
return TSDB_PERFS_TABLE_TOPICS;
|
||||||
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
||||||
return TSDB_PERFS_TABLE_TRANS;
|
return TSDB_PERFS_TABLE_TRANS;
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
return TSDB_INS_TABLE_CONFIGS;
|
return TSDB_INS_TABLE_CONFIGS;
|
||||||
case QUERY_NODE_SHOW_APPS_STMT:
|
case QUERY_NODE_SHOW_APPS_STMT:
|
||||||
return TSDB_PERFS_TABLE_APPS;
|
return TSDB_PERFS_TABLE_APPS;
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
|
return TSDB_INS_TABLE_DNODE_VARIABLES;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4725,6 +4785,21 @@ static int32_t rewriteShow(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
|
SSelectStmt* pStmt = NULL;
|
||||||
|
int32_t code = createSelectStmtForShow(nodeType(pQuery->pRoot), &pStmt);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", ((SShowDnodeVariablesStmt*)pQuery->pRoot)->pDnodeId,
|
||||||
|
&pStmt->pWhere);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
pQuery->showRewrite = true;
|
||||||
|
nodesDestroyNode(pQuery->pRoot);
|
||||||
|
pQuery->pRoot = (SNode*)pStmt;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static SNode* createBlockDistInfoFunc() {
|
static SNode* createBlockDistInfoFunc() {
|
||||||
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||||
if (NULL == pFunc) {
|
if (NULL == pFunc) {
|
||||||
|
@ -5720,10 +5795,13 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_CLUSTER_STMT:
|
case QUERY_NODE_SHOW_CLUSTER_STMT:
|
||||||
case QUERY_NODE_SHOW_TOPICS_STMT:
|
case QUERY_NODE_SHOW_TOPICS_STMT:
|
||||||
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_VARIABLE_STMT:
|
case QUERY_NODE_SHOW_VARIABLES_STMT:
|
||||||
case QUERY_NODE_SHOW_APPS_STMT:
|
case QUERY_NODE_SHOW_APPS_STMT:
|
||||||
code = rewriteShow(pCxt, pQuery);
|
code = rewriteShow(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT:
|
||||||
|
code = rewriteShowDnodeVariables(pCxt, pQuery);
|
||||||
|
break;
|
||||||
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
|
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
|
||||||
code = rewriteShowTableDist(pCxt, pQuery);
|
code = rewriteShowTableDist(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
@ -5814,6 +5892,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_RESET_QUERY_CACHE_STMT:
|
case QUERY_NODE_RESET_QUERY_CACHE_STMT:
|
||||||
case QUERY_NODE_ALTER_LOCAL_STMT:
|
case QUERY_NODE_ALTER_LOCAL_STMT:
|
||||||
|
case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT:
|
||||||
pQuery->execMode = QUERY_EXEC_MODE_LOCAL;
|
pQuery->execMode = QUERY_EXEC_MODE_LOCAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -561,6 +561,7 @@ int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalog
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildTableReq(pMetaCache->pTableIndex, &pCatalogReq->pTableIndex);
|
code = buildTableReq(pMetaCache->pTableIndex, &pCatalogReq->pTableIndex);
|
||||||
}
|
}
|
||||||
|
pCatalogReq->dNodeRequired = pMetaCache->dnodeRequired;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,6 +657,7 @@ int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMet
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = putTableDataToCache(pCatalogReq->pTableIndex, pMetaData->pTableIndex, &pMetaCache->pTableIndex);
|
code = putTableDataToCache(pCatalogReq->pTableIndex, pMetaData->pTableIndex, &pMetaCache->pTableIndex);
|
||||||
}
|
}
|
||||||
|
pMetaCache->pDnodes = pMetaData->pDnodeList;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,6 +877,19 @@ int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName,
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t reserveDnodeRequiredInCache(SParseMetaCache* pMetaCache) {
|
||||||
|
pMetaCache->dnodeRequired = true;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t getDnodeListFromCache(SParseMetaCache* pMetaCache, SArray** pDnodes) {
|
||||||
|
*pDnodes = taosArrayDup(pMetaCache->pDnodes);
|
||||||
|
if (NULL == *pDnodes) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void destoryParseMetaCache(SParseMetaCache* pMetaCache) {
|
void destoryParseMetaCache(SParseMetaCache* pMetaCache) {
|
||||||
taosHashCleanup(pMetaCache->pTableMeta);
|
taosHashCleanup(pMetaCache->pTableMeta);
|
||||||
taosHashCleanup(pMetaCache->pDbVgroup);
|
taosHashCleanup(pMetaCache->pDbVgroup);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -93,6 +93,16 @@ void generateInformationSchema(MockCatalogService* mcs) {
|
||||||
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
|
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
|
||||||
builder.done();
|
builder.done();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
ITableBuilder& builder = mcs->createTableBuilder("information_schema", "configs", TSDB_SYSTEM_TABLE, 1)
|
||||||
|
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_CONFIG_OPTION_LEN);
|
||||||
|
builder.done();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ITableBuilder& builder = mcs->createTableBuilder("information_schema", "dnode_variables", TSDB_SYSTEM_TABLE, 1)
|
||||||
|
.addColumn("dnode_id", TSDB_DATA_TYPE_INT);
|
||||||
|
builder.done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generatePerformanceSchema(MockCatalogService* mcs) {
|
void generatePerformanceSchema(MockCatalogService* mcs) {
|
||||||
|
@ -187,6 +197,12 @@ void generateFunctions(MockCatalogService* mcs) {
|
||||||
8);
|
8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void generateDnodes(MockCatalogService* mcs) {
|
||||||
|
mcs->createDnode(1, "host1", 7030);
|
||||||
|
mcs->createDnode(2, "host2", 7030);
|
||||||
|
mcs->createDnode(3, "host3", 7030);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int32_t __catalogGetHandle(const char* clusterId, struct SCatalog** catalogHandle) { return 0; }
|
int32_t __catalogGetHandle(const char* clusterId, struct SCatalog** catalogHandle) { return 0; }
|
||||||
|
@ -241,6 +257,10 @@ int32_t __catalogGetTableIndex(SCatalog* pCtg, void* pTrans, const SEpSet* pMgmt
|
||||||
return g_mockCatalogService->catalogGetTableIndex(pName, pRes);
|
return g_mockCatalogService->catalogGetTableIndex(pName, pRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t __catalogGetDnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray** pDnodeList) {
|
||||||
|
return g_mockCatalogService->catalogGetDnodeList(pDnodeList);
|
||||||
|
}
|
||||||
|
|
||||||
void initMetaDataEnv() {
|
void initMetaDataEnv() {
|
||||||
g_mockCatalogService.reset(new MockCatalogService());
|
g_mockCatalogService.reset(new MockCatalogService());
|
||||||
|
|
||||||
|
@ -258,6 +278,7 @@ void initMetaDataEnv() {
|
||||||
stub.set(catalogRefreshGetTableMeta, __catalogRefreshGetTableMeta);
|
stub.set(catalogRefreshGetTableMeta, __catalogRefreshGetTableMeta);
|
||||||
stub.set(catalogRemoveTableMeta, __catalogRemoveTableMeta);
|
stub.set(catalogRemoveTableMeta, __catalogRemoveTableMeta);
|
||||||
stub.set(catalogGetTableIndex, __catalogGetTableIndex);
|
stub.set(catalogGetTableIndex, __catalogGetTableIndex);
|
||||||
|
stub.set(catalogGetDnodeList, __catalogGetDnodeList);
|
||||||
// {
|
// {
|
||||||
// AddrAny any("libcatalog.so");
|
// AddrAny any("libcatalog.so");
|
||||||
// std::map<std::string,void*> result;
|
// std::map<std::string,void*> result;
|
||||||
|
@ -307,6 +328,7 @@ void generateMetaData() {
|
||||||
generateTestST1(g_mockCatalogService.get());
|
generateTestST1(g_mockCatalogService.get());
|
||||||
generateTestST2(g_mockCatalogService.get());
|
generateTestST2(g_mockCatalogService.get());
|
||||||
generateFunctions(g_mockCatalogService.get());
|
generateFunctions(g_mockCatalogService.get());
|
||||||
|
generateDnodes(g_mockCatalogService.get());
|
||||||
g_mockCatalogService->showTables();
|
g_mockCatalogService->showTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,14 @@ class MockCatalogServiceImpl {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t catalogGetDnodeList(SArray** pDnodes) const {
|
||||||
|
*pDnodes = taosArrayInit(dnode_.size(), sizeof(SEpSet));
|
||||||
|
for (const auto& dnode : dnode_) {
|
||||||
|
taosArrayPush(*pDnodes, &dnode.second);
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const {
|
int32_t catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const {
|
||||||
int32_t code = getAllTableMeta(pCatalogReq->pTableMeta, &pMetaData->pTableMeta);
|
int32_t code = getAllTableMeta(pCatalogReq->pTableMeta, &pMetaData->pTableMeta);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -188,6 +196,9 @@ class MockCatalogServiceImpl {
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = getAllTableIndex(pCatalogReq->pTableIndex, &pMetaData->pTableIndex);
|
code = getAllTableIndex(pCatalogReq->pTableIndex, &pMetaData->pTableIndex);
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code && pCatalogReq->dNodeRequired) {
|
||||||
|
code = catalogGetDnodeList(&pMetaData->pDnodeList);
|
||||||
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,11 +314,18 @@ class MockCatalogServiceImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createDnode(int32_t dnodeId, const std::string& host, int16_t port) {
|
||||||
|
SEpSet epSet = {0};
|
||||||
|
addEpIntoEpSet(&epSet, host.c_str(), port);
|
||||||
|
dnode_.insert(std::make_pair(dnodeId, epSet));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<std::string, std::shared_ptr<MockTableMeta>> TableMetaCache;
|
typedef std::map<std::string, std::shared_ptr<MockTableMeta>> TableMetaCache;
|
||||||
typedef std::map<std::string, TableMetaCache> DbMetaCache;
|
typedef std::map<std::string, TableMetaCache> DbMetaCache;
|
||||||
typedef std::map<std::string, std::shared_ptr<SFuncInfo>> UdfMetaCache;
|
typedef std::map<std::string, std::shared_ptr<SFuncInfo>> UdfMetaCache;
|
||||||
typedef std::map<std::string, std::vector<STableIndexInfo>> IndexMetaCache;
|
typedef std::map<std::string, std::vector<STableIndexInfo>> IndexMetaCache;
|
||||||
|
typedef std::map<int32_t, SEpSet> DnodeCache;
|
||||||
|
|
||||||
uint64_t getNextId() { return id_++; }
|
uint64_t getNextId() { return id_++; }
|
||||||
|
|
||||||
|
@ -532,6 +550,7 @@ class MockCatalogServiceImpl {
|
||||||
DbMetaCache meta_;
|
DbMetaCache meta_;
|
||||||
UdfMetaCache udf_;
|
UdfMetaCache udf_;
|
||||||
IndexMetaCache index_;
|
IndexMetaCache index_;
|
||||||
|
DnodeCache dnode_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MockCatalogService::MockCatalogService() : impl_(new MockCatalogServiceImpl()) {}
|
MockCatalogService::MockCatalogService() : impl_(new MockCatalogServiceImpl()) {}
|
||||||
|
@ -557,6 +576,10 @@ void MockCatalogService::createFunction(const std::string& func, int8_t funcType
|
||||||
|
|
||||||
void MockCatalogService::createSmaIndex(const SMCreateSmaReq* pReq) { impl_->createSmaIndex(pReq); }
|
void MockCatalogService::createSmaIndex(const SMCreateSmaReq* pReq) { impl_->createSmaIndex(pReq); }
|
||||||
|
|
||||||
|
void MockCatalogService::createDnode(int32_t dnodeId, const std::string& host, int16_t port) {
|
||||||
|
impl_->createDnode(dnodeId, host, port);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const {
|
int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const {
|
||||||
return impl_->catalogGetTableMeta(pTableName, pTableMeta);
|
return impl_->catalogGetTableMeta(pTableName, pTableMeta);
|
||||||
}
|
}
|
||||||
|
@ -581,6 +604,8 @@ int32_t MockCatalogService::catalogGetTableIndex(const SName* pTableName, SArray
|
||||||
return impl_->catalogGetTableIndex(pTableName, pIndexes);
|
return impl_->catalogGetTableIndex(pTableName, pIndexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t MockCatalogService::catalogGetDnodeList(SArray** pDnodes) const { return impl_->catalogGetDnodeList(pDnodes); }
|
||||||
|
|
||||||
int32_t MockCatalogService::catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const {
|
int32_t MockCatalogService::catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const {
|
||||||
return impl_->catalogGetAllMeta(pCatalogReq, pMetaData);
|
return impl_->catalogGetAllMeta(pCatalogReq, pMetaData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ class MockCatalogService {
|
||||||
void showTables() const;
|
void showTables() const;
|
||||||
void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize);
|
void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize);
|
||||||
void createSmaIndex(const SMCreateSmaReq* pReq);
|
void createSmaIndex(const SMCreateSmaReq* pReq);
|
||||||
|
void createDnode(int32_t dnodeId, const std::string& host, int16_t port);
|
||||||
|
|
||||||
int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const;
|
int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const;
|
||||||
int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo) const;
|
int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo) const;
|
||||||
|
@ -69,6 +70,7 @@ class MockCatalogService {
|
||||||
int32_t catalogGetDBVgInfo(const char* pDbFName, SArray** pVgList) const;
|
int32_t catalogGetDBVgInfo(const char* pDbFName, SArray** pVgList) const;
|
||||||
int32_t catalogGetUdfInfo(const std::string& funcName, SFuncInfo* pInfo) const;
|
int32_t catalogGetUdfInfo(const std::string& funcName, SFuncInfo* pInfo) const;
|
||||||
int32_t catalogGetTableIndex(const SName* pTableName, SArray** pIndexes) const;
|
int32_t catalogGetTableIndex(const SName* pTableName, SArray** pIndexes) const;
|
||||||
|
int32_t catalogGetDnodeList(SArray** pDnodes) const;
|
||||||
int32_t catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const;
|
int32_t catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -159,7 +159,35 @@ TEST_F(ParserInitialDTest, dropSTable) {
|
||||||
run("DROP STABLE st1");
|
run("DROP STABLE st1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo DROP stream
|
TEST_F(ParserInitialDTest, dropStream) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
SMDropStreamReq expect = {0};
|
||||||
|
|
||||||
|
auto clearDropStreamReq = [&]() { memset(&expect, 0, sizeof(SMDropStreamReq)); };
|
||||||
|
|
||||||
|
auto setDropStreamReq = [&](const char* pStream, int8_t igNotExists = 0) {
|
||||||
|
sprintf(expect.name, "0.%s", pStream);
|
||||||
|
expect.igNotExists = igNotExists;
|
||||||
|
};
|
||||||
|
|
||||||
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
|
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_DROP_STREAM_STMT);
|
||||||
|
SMDropStreamReq req = {0};
|
||||||
|
ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSMDropStreamReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req));
|
||||||
|
|
||||||
|
ASSERT_EQ(std::string(req.name), std::string(expect.name));
|
||||||
|
ASSERT_EQ(req.igNotExists, expect.igNotExists);
|
||||||
|
});
|
||||||
|
|
||||||
|
setDropStreamReq("s1");
|
||||||
|
run("DROP STREAM s1");
|
||||||
|
clearDropStreamReq();
|
||||||
|
|
||||||
|
setDropStreamReq("s2", 1);
|
||||||
|
run("DROP STREAM IF EXISTS s2");
|
||||||
|
clearDropStreamReq();
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialDTest, dropTable) {
|
TEST_F(ParserInitialDTest, dropTable) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
|
@ -76,6 +76,12 @@ TEST_F(ParserShowToUseTest, showDnodes) {
|
||||||
run("SHOW dnodes");
|
run("SHOW dnodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ParserShowToUseTest, showDnodeVariables) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("SHOW DNODE 1 VARIABLES");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserShowToUseTest, showFunctions) {
|
TEST_F(ParserShowToUseTest, showFunctions) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
|
@ -84,6 +90,12 @@ TEST_F(ParserShowToUseTest, showFunctions) {
|
||||||
|
|
||||||
// todo SHOW licence
|
// todo SHOW licence
|
||||||
|
|
||||||
|
TEST_F(ParserShowToUseTest, showLocalVariables) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("SHOW LOCAL VARIABLES");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserShowToUseTest, showIndexes) {
|
TEST_F(ParserShowToUseTest, showIndexes) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
|
@ -157,7 +169,11 @@ TEST_F(ParserShowToUseTest, showUsers) {
|
||||||
run("SHOW users");
|
run("SHOW users");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo SHOW variables
|
TEST_F(ParserShowToUseTest, showVariables) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("SHOW VARIABLES");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ParserShowToUseTest, showVgroups) {
|
TEST_F(ParserShowToUseTest, showVgroups) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
|
@ -1056,28 +1056,47 @@ static bool partTagsOptHasCol(SNodeList* pPartKeys) {
|
||||||
return hasCol;
|
return hasCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool partTagsIsOptimizableNode(SLogicNode* pNode) {
|
||||||
|
return ((QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) /*||
|
||||||
|
(QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode) && NULL != ((SAggLogicNode*)pNode)->pGroupKeys &&
|
||||||
|
NULL != ((SAggLogicNode*)pNode)->pAggFuncs)*/) &&
|
||||||
|
1 == LIST_LENGTH(pNode->pChildren) &&
|
||||||
|
QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(nodesListGetNode(pNode->pChildren, 0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static SNodeList* partTagsGetPartKeys(SLogicNode* pNode) {
|
||||||
|
if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) {
|
||||||
|
return ((SPartitionLogicNode*)pNode)->pPartitionKeys;
|
||||||
|
} else {
|
||||||
|
return ((SAggLogicNode*)pNode)->pGroupKeys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool partTagsOptMayBeOptimized(SLogicNode* pNode) {
|
static bool partTagsOptMayBeOptimized(SLogicNode* pNode) {
|
||||||
if (QUERY_NODE_LOGIC_PLAN_PARTITION != nodeType(pNode) || 1 != LIST_LENGTH(pNode->pChildren) ||
|
if (!partTagsIsOptimizableNode(pNode)) {
|
||||||
QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pNode->pChildren, 0))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !partTagsOptHasCol(((SPartitionLogicNode*)pNode)->pPartitionKeys);
|
return !partTagsOptHasCol(partTagsGetPartKeys(pNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
|
static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) {
|
||||||
SPartitionLogicNode* pPart =
|
SLogicNode* pNode = optFindPossibleNode(pLogicSubplan->pNode, partTagsOptMayBeOptimized);
|
||||||
(SPartitionLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, partTagsOptMayBeOptimized);
|
if (NULL == pNode) {
|
||||||
if (NULL == pPart) {
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SScanLogicNode* pScan = (SScanLogicNode*)nodesListGetNode(pPart->node.pChildren, 0);
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
TSWAP(pPart->pPartitionKeys, pScan->pPartTags);
|
SScanLogicNode* pScan = (SScanLogicNode*)nodesListGetNode(pNode->pChildren, 0);
|
||||||
int32_t code = replaceLogicNode(pLogicSubplan, (SLogicNode*)pPart, (SLogicNode*)pScan);
|
if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) {
|
||||||
|
TSWAP(((SPartitionLogicNode*)pNode)->pPartitionKeys, pScan->pPartTags);
|
||||||
|
int32_t code = replaceLogicNode(pLogicSubplan, pNode, (SLogicNode*)pScan);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
NODES_CLEAR_LIST(pPart->node.pChildren);
|
NODES_CLEAR_LIST(pNode->pChildren);
|
||||||
nodesDestroyNode((SNode*)pPart);
|
nodesDestroyNode((SNode*)pNode);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TSWAP(((SAggLogicNode*)pNode)->pGroupKeys, pScan->pPartTags);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1093,7 +1112,8 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode;
|
SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode;
|
||||||
if (-1 != pProjectNode->limit || -1 != pProjectNode->slimit || -1 != pProjectNode->offset || -1 != pProjectNode->soffset) {
|
if (-1 != pProjectNode->limit || -1 != pProjectNode->slimit || -1 != pProjectNode->offset ||
|
||||||
|
-1 != pProjectNode->soffset) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,7 +1141,8 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SProjectLogicNode* pProjectNode) {
|
static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan,
|
||||||
|
SProjectLogicNode* pProjectNode) {
|
||||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->node.pChildren, 0);
|
||||||
SNodeList* pNewChildTargets = nodesMakeList();
|
SNodeList* pNewChildTargets = nodesMakeList();
|
||||||
|
|
||||||
|
|
|
@ -534,7 +534,11 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
|
||||||
}
|
}
|
||||||
SQueryNodeLoad node = {.addr = {.nodeId = MNODE_HANDLE, .epSet = pCxt->pPlanCxt->mgmtEpSet}, .load = 0};
|
SQueryNodeLoad node = {.addr = {.nodeId = MNODE_HANDLE, .epSet = pCxt->pPlanCxt->mgmtEpSet}, .load = 0};
|
||||||
taosArrayPush(pCxt->pExecNodeList, &node);
|
taosArrayPush(pCxt->pExecNodeList, &node);
|
||||||
|
if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_DNODE_VARIABLES)) {
|
||||||
|
pScan->mgmtEpSet = pScanLogicNode->pVgroupList->vgroups->epSet;
|
||||||
|
} else {
|
||||||
pScan->mgmtEpSet = pCxt->pPlanCxt->mgmtEpSet;
|
pScan->mgmtEpSet = pCxt->pPlanCxt->mgmtEpSet;
|
||||||
|
}
|
||||||
tNameGetFullDbName(&pScanLogicNode->tableName, pSubplan->dbFName);
|
tNameGetFullDbName(&pScanLogicNode->tableName, pSubplan->dbFName);
|
||||||
|
|
||||||
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode);
|
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode);
|
||||||
|
@ -879,12 +883,15 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh
|
||||||
pInterpFunc->interval = pFuncLogicNode->interval;
|
pInterpFunc->interval = pFuncLogicNode->interval;
|
||||||
pInterpFunc->fillMode = pFuncLogicNode->fillMode;
|
pInterpFunc->fillMode = pFuncLogicNode->fillMode;
|
||||||
pInterpFunc->pFillValues = nodesCloneNode(pFuncLogicNode->pFillValues);
|
pInterpFunc->pFillValues = nodesCloneNode(pFuncLogicNode->pFillValues);
|
||||||
pInterpFunc->pTimeSeries = nodesCloneNode(pFuncLogicNode->pTimeSeries);
|
if (NULL != pFuncLogicNode->pFillValues && NULL == pInterpFunc->pFillValues) {
|
||||||
if (NULL == pInterpFunc->pTimeSeries || (NULL != pFuncLogicNode->pFillValues && NULL == pInterpFunc->pFillValues)) {
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pFuncLogicNode->pTimeSeries, &pInterpFunc->pTimeSeries);
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pPhyNode = (SPhysiNode*)pInterpFunc;
|
*pPhyNode = (SPhysiNode*)pInterpFunc;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,14 +45,21 @@ TEST_F(PlanOptimizeTest, ConditionPushDown) {
|
||||||
TEST_F(PlanOptimizeTest, orderByPrimaryKey) {
|
TEST_F(PlanOptimizeTest, orderByPrimaryKey) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
run("SELECT * FROM t1 ORDER BY ts");
|
|
||||||
run("SELECT * FROM t1 ORDER BY ts DESC");
|
|
||||||
run("SELECT c1 FROM t1 ORDER BY ts");
|
run("SELECT c1 FROM t1 ORDER BY ts");
|
||||||
|
|
||||||
run("SELECT c1 FROM t1 ORDER BY ts DESC");
|
run("SELECT c1 FROM t1 ORDER BY ts DESC");
|
||||||
|
|
||||||
run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTARTTS DESC");
|
run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTARTTS DESC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(PlanOptimizeTest, PartitionTags) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("SELECT c1 FROM st1 PARTITION BY tag1");
|
||||||
|
|
||||||
|
run("SELECT SUM(c1) FROM st1 GROUP BY tag1");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(PlanOptimizeTest, eliminateProjection) {
|
TEST_F(PlanOptimizeTest, eliminateProjection) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,8 @@ TEST_F(PlanOtherTest, show) {
|
||||||
run("SHOW TABLE DISTRIBUTED t1");
|
run("SHOW TABLE DISTRIBUTED t1");
|
||||||
|
|
||||||
run("SHOW TABLE DISTRIBUTED st1");
|
run("SHOW TABLE DISTRIBUTED st1");
|
||||||
|
|
||||||
|
run("SHOW DNODE 1 VARIABLES");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PlanOtherTest, delete) {
|
TEST_F(PlanOtherTest, delete) {
|
||||||
|
|
Loading…
Reference in New Issue