提交 50181dad 编写于 作者: X Xiaoyu Wang

feat: performance_schema related SHOW statements are rewritten, and KILL...

feat: performance_schema related SHOW statements are rewritten, and KILL statements build the message
上级 9a59e944
...@@ -267,6 +267,11 @@ typedef struct SDescribeStmt { ...@@ -267,6 +267,11 @@ typedef struct SDescribeStmt {
STableMeta* pMeta; STableMeta* pMeta;
} SDescribeStmt; } SDescribeStmt;
typedef struct SKillStmt {
ENodeType type;
int32_t targetId;
} SKillStmt;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -1366,27 +1366,35 @@ static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* ...@@ -1366,27 +1366,35 @@ static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt*
return checkDatabaseOptions(pCxt, pStmt->pOptions); return checkDatabaseOptions(pCxt, pStmt->pOptions);
} }
static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { typedef int32_t (*FSerializeFunc)(void *pBuf, int32_t bufLen, void *pReq);
SCreateDbReq createReq = {0};
int32_t code = checkCreateDatabase(pCxt, pStmt);
if (TSDB_CODE_SUCCESS == code) {
code = buildCreateDbReq(pCxt, pStmt, &createReq);
}
if (TSDB_CODE_SUCCESS == code) { static int32_t buildCmdMsg(STranslateContext* pCxt, int16_t msgType, FSerializeFunc func, void* pReq) {
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) { if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_DB; pCxt->pCmdMsg->msgType = msgType;
pCxt->pCmdMsg->msgLen = tSerializeSCreateDbReq(NULL, 0, &createReq); pCxt->pCmdMsg->msgLen = func(NULL, 0, pReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen); pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) { if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
tSerializeSCreateDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq); func(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, pReq);
return TSDB_CODE_SUCCESS;
}
static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) {
SCreateDbReq createReq = {0};
int32_t code = checkCreateDatabase(pCxt, pStmt);
if (TSDB_CODE_SUCCESS == code) {
code = buildCreateDbReq(pCxt, pStmt, &createReq);
}
if (TSDB_CODE_SUCCESS == code) {
code = buildCmdMsg(pCxt, TDMT_MND_CREATE_DB, (FSerializeFunc)tSerializeSCreateDbReq, &createReq);
} }
return code; return code;
...@@ -1399,20 +1407,7 @@ static int32_t translateDropDatabase(STranslateContext* pCxt, SDropDatabaseStmt* ...@@ -1399,20 +1407,7 @@ static int32_t translateDropDatabase(STranslateContext* pCxt, SDropDatabaseStmt*
tNameGetFullDbName(&name, dropReq.db); tNameGetFullDbName(&name, dropReq.db);
dropReq.ignoreNotExists = pStmt->ignoreNotExists; dropReq.ignoreNotExists = pStmt->ignoreNotExists;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_DROP_DB, (FSerializeFunc)tSerializeSDropDbReq, &dropReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_DROP_DB;
pCxt->pCmdMsg->msgLen = tSerializeSDropDbReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSDropDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, SAlterDbReq* pReq) { static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, SAlterDbReq* pReq) {
...@@ -1440,20 +1435,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm ...@@ -1440,20 +1435,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm
SAlterDbReq alterReq = {0}; SAlterDbReq alterReq = {0};
buildAlterDbReq(pCxt, pStmt, &alterReq); buildAlterDbReq(pCxt, pStmt, &alterReq);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_ALTER_DB, (FSerializeFunc)tSerializeSAlterDbReq, &alterReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_ALTER_DB;
pCxt->pCmdMsg->msgLen = tSerializeSAlterDbReq(NULL, 0, &alterReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSAlterDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &alterReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t calcTypeBytes(SDataType dt) { static int32_t calcTypeBytes(SDataType dt) {
...@@ -1615,23 +1597,9 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt ...@@ -1615,23 +1597,9 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt
strcpy(tableName.tname, pStmt->tableName); strcpy(tableName.tname, pStmt->tableName);
tNameExtractFullName(&tableName, createReq.name); tNameExtractFullName(&tableName, createReq.name);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STB, (FSerializeFunc)tSerializeSMCreateStbReq, &createReq);
if (NULL == pCxt->pCmdMsg) {
tFreeSMCreateStbReq(&createReq); tFreeSMCreateStbReq(&createReq);
return TSDB_CODE_OUT_OF_MEMORY; return code;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_STB;
pCxt->pCmdMsg->msgLen = tSerializeSMCreateStbReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
tFreeSMCreateStbReq(&createReq);
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSMCreateStbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
tFreeSMCreateStbReq(&createReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* pTableName, bool ignoreNotExists) { static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* pTableName, bool ignoreNotExists) {
...@@ -1639,20 +1607,7 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p ...@@ -1639,20 +1607,7 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p
tNameExtractFullName(pTableName, dropReq.name); tNameExtractFullName(pTableName, dropReq.name);
dropReq.igNotExists = ignoreNotExists; dropReq.igNotExists = ignoreNotExists;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_DROP_STB, (FSerializeFunc)tSerializeSMDropStbReq, &dropReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_DROP_STB;
pCxt->pCmdMsg->msgLen = tSerializeSMDropStbReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSMDropStbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) { static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) {
...@@ -1736,20 +1691,7 @@ static int32_t translateAlterTable(STranslateContext* pCxt, SAlterTableStmt* pSt ...@@ -1736,20 +1691,7 @@ static int32_t translateAlterTable(STranslateContext* pCxt, SAlterTableStmt* pSt
} }
} }
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_ALTER_STB, (FSerializeFunc)tSerializeSMAlterStbReq, &alterReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_ALTER_STB;
pCxt->pCmdMsg->msgLen = tSerializeSMAlterStbReq(NULL, 0, &alterReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSMAlterStbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &alterReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* pStmt) { static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* pStmt) {
...@@ -1758,24 +1700,10 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p ...@@ -1758,24 +1700,10 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
tNameExtractFullName(&name, usedbReq.db); tNameExtractFullName(&name, usedbReq.db);
int32_t code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable); int32_t code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS == code) {
return code; code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq);
}
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_USE_DB;
pCxt->pCmdMsg->msgLen = tSerializeSUseDbReq(NULL, 0, &usedbReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
} }
tSerializeSUseDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &usedbReq); return code;
return TSDB_CODE_SUCCESS;
} }
static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pStmt) { static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pStmt) {
...@@ -1785,20 +1713,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt ...@@ -1785,20 +1713,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
createReq.superUser = 0; createReq.superUser = 0;
strcpy(createReq.pass, pStmt->password); strcpy(createReq.pass, pStmt->password);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_CREATE_USER, (FSerializeFunc)tSerializeSCreateUserReq, &createReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_USER;
pCxt->pCmdMsg->msgLen = tSerializeSCreateUserReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCreateUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt) { static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt) {
...@@ -1811,40 +1726,14 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt ...@@ -1811,40 +1726,14 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
strcpy(alterReq.dbname, pCxt->pParseCxt->db); strcpy(alterReq.dbname, pCxt->pParseCxt->db);
} }
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_ALTER_USER;
pCxt->pCmdMsg->msgLen = tSerializeSAlterUserReq(NULL, 0, &alterReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSAlterUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &alterReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateDropUser(STranslateContext* pCxt, SDropUserStmt* pStmt) { static int32_t translateDropUser(STranslateContext* pCxt, SDropUserStmt* pStmt) {
SDropUserReq dropReq = {0}; SDropUserReq dropReq = {0};
strcpy(dropReq.user, pStmt->useName); strcpy(dropReq.user, pStmt->useName);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_DROP_USER, (FSerializeFunc)tSerializeSDropUserReq, &dropReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_DROP_USER;
pCxt->pCmdMsg->msgLen = tSerializeSDropUserReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSDropUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* pStmt) { static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* pStmt) {
...@@ -1852,20 +1741,7 @@ static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* p ...@@ -1852,20 +1741,7 @@ static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* p
strcpy(createReq.fqdn, pStmt->fqdn); strcpy(createReq.fqdn, pStmt->fqdn);
createReq.port = pStmt->port; createReq.port = pStmt->port;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_CREATE_DNODE, (FSerializeFunc)tSerializeSCreateDnodeReq, &createReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_DNODE;
pCxt->pCmdMsg->msgLen = tSerializeSCreateDnodeReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCreateDnodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt) { static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt) {
...@@ -1874,20 +1750,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt ...@@ -1874,20 +1750,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt
strcpy(dropReq.fqdn, pStmt->fqdn); strcpy(dropReq.fqdn, pStmt->fqdn);
dropReq.port = pStmt->port; dropReq.port = pStmt->port;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_DROP_DNODE, (FSerializeFunc)tSerializeSDropDnodeReq, &dropReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_DROP_DNODE;
pCxt->pCmdMsg->msgLen = tSerializeSDropDnodeReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSDropDnodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pStmt) { static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pStmt) {
...@@ -1896,20 +1759,7 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt ...@@ -1896,20 +1759,7 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt
strcpy(cfgReq.config, pStmt->config); strcpy(cfgReq.config, pStmt->config);
strcpy(cfgReq.value, pStmt->value); strcpy(cfgReq.value, pStmt->value);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_CONFIG_DNODE, (FSerializeFunc)tSerializeSMCfgDnodeReq, &cfgReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CONFIG_DNODE;
pCxt->pCmdMsg->msgLen = tSerializeSMCfgDnodeReq(NULL, 0, &cfgReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSMCfgDnodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &cfgReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t nodeTypeToShowType(ENodeType nt) { static int32_t nodeTypeToShowType(ENodeType nt) {
...@@ -1936,21 +1786,7 @@ static int32_t nodeTypeToShowType(ENodeType nt) { ...@@ -1936,21 +1786,7 @@ static int32_t nodeTypeToShowType(ENodeType nt) {
static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) { static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) {
SShowReq showReq = {.type = nodeTypeToShowType(nodeType(pStmt))}; SShowReq showReq = {.type = nodeTypeToShowType(nodeType(pStmt))};
return buildCmdMsg(pCxt, TDMT_MND_SHOW, (FSerializeFunc)tSerializeSShowReq, &showReq);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_SHOW;
pCxt->pCmdMsg->msgLen = tSerializeSShowReq(NULL, 0, &showReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSShowReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &showReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, char* pTableName, int32_t* pVgId) { static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, char* pTableName, int32_t* pVgId) {
...@@ -2070,61 +1906,25 @@ static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt ...@@ -2070,61 +1906,25 @@ static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt
} }
SMCreateSmaReq createSmaReq = {0}; SMCreateSmaReq createSmaReq = {0};
int32_t code = buildCreateSmaReq(pCxt, pStmt, &createSmaReq); int32_t code = buildCreateSmaReq(pCxt, pStmt, &createSmaReq);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS == code) {
return code; code = buildCmdMsg(pCxt, TDMT_MND_CREATE_SMA, (FSerializeFunc)tSerializeSMCreateSmaReq, &createSmaReq);
}
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_SMA;
pCxt->pCmdMsg->msgLen = tSerializeSMCreateSmaReq(NULL, 0, &createSmaReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
} }
tSerializeSMCreateSmaReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createSmaReq);
tFreeSMCreateSmaReq(&createSmaReq); tFreeSMCreateSmaReq(&createSmaReq);
return code;
return TSDB_CODE_SUCCESS;
} }
static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateFullTextReq* pReq) { static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateFullTextReq* pReq) {
// impl later // impl later
return 0; return 0;
} }
static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) { static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
if (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pInterval) ||
(NULL != pStmt->pOptions->pOffset &&
DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pOffset)) ||
(NULL != pStmt->pOptions->pSliding &&
DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pSliding))) {
return pCxt->errCode;
}
SMCreateFullTextReq createFTReq = {0}; SMCreateFullTextReq createFTReq = {0};
int32_t code = buildCreateFullTextReq(pCxt, pStmt, &createFTReq); int32_t code = buildCreateFullTextReq(pCxt, pStmt, &createFTReq);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS == code) {
return code; code = buildCmdMsg(pCxt, TDMT_MND_CREATE_INDEX, (FSerializeFunc)tSerializeSMCreateFullTextReq, &createFTReq);
}
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_INDEX;
pCxt->pCmdMsg->msgLen = tSerializeSMCreateFullTextReq(NULL, 0, &createFTReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
} }
tSerializeSMCreateFullTextReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createFTReq);
tFreeSMCreateFullTextReq(&createFTReq); tFreeSMCreateFullTextReq(&createFTReq);
return code;
return TSDB_CODE_SUCCESS;
} }
static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) { static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
...@@ -2132,7 +1932,6 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p ...@@ -2132,7 +1932,6 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p
return translateCreateSmaIndex(pCxt, pStmt); return translateCreateSmaIndex(pCxt, pStmt);
} else if (INDEX_TYPE_FULLTEXT == pStmt->indexType) { } else if (INDEX_TYPE_FULLTEXT == pStmt->indexType) {
return translateCreateFullTextIndex(pCxt, pStmt); return translateCreateFullTextIndex(pCxt, pStmt);
// todo fulltext index
} }
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
...@@ -2176,21 +1975,7 @@ static int16_t getCreateComponentNodeMsgType(ENodeType type) { ...@@ -2176,21 +1975,7 @@ static int16_t getCreateComponentNodeMsgType(ENodeType type) {
static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComponentNodeStmt* pStmt) { static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComponentNodeStmt* pStmt) {
SMCreateQnodeReq createReq = {.dnodeId = pStmt->dnodeId}; SMCreateQnodeReq createReq = {.dnodeId = pStmt->dnodeId};
return buildCmdMsg(pCxt, getCreateComponentNodeMsgType(nodeType(pStmt)), (FSerializeFunc)tSerializeSCreateDropMQSBNodeReq, &createReq);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = getCreateComponentNodeMsgType(nodeType(pStmt));
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
return TSDB_CODE_SUCCESS;
} }
static int16_t getDropComponentNodeMsgType(ENodeType type) { static int16_t getDropComponentNodeMsgType(ENodeType type) {
...@@ -2211,21 +1996,7 @@ static int16_t getDropComponentNodeMsgType(ENodeType type) { ...@@ -2211,21 +1996,7 @@ static int16_t getDropComponentNodeMsgType(ENodeType type) {
static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponentNodeStmt* pStmt) { static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponentNodeStmt* pStmt) {
SDDropQnodeReq dropReq = {.dnodeId = pStmt->dnodeId}; SDDropQnodeReq dropReq = {.dnodeId = pStmt->dnodeId};
return buildCmdMsg(pCxt, getDropComponentNodeMsgType(nodeType(pStmt)), (FSerializeFunc)tSerializeSCreateDropMQSBNodeReq, &dropReq);
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = getDropComponentNodeMsgType(nodeType(pStmt));
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* pStmt) { static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* pStmt) {
...@@ -2255,21 +2026,9 @@ static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* p ...@@ -2255,21 +2026,9 @@ static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* p
tNameExtractFullName(&name, createReq.name); tNameExtractFullName(&name, createReq.name);
createReq.igExists = pStmt->ignoreExists; createReq.igExists = pStmt->ignoreExists;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); int32_t code = buildCmdMsg(pCxt, TDMT_MND_CREATE_TOPIC, (FSerializeFunc)tSerializeSCMCreateTopicReq, &createReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_TOPIC;
pCxt->pCmdMsg->msgLen = tSerializeSCMCreateTopicReq(NULL, 0, &createReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSCMCreateTopicReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
tFreeSCMCreateTopicReq(&createReq); tFreeSCMCreateTopicReq(&createReq);
return code;
return TSDB_CODE_SUCCESS;
} }
static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt) { static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt) {
...@@ -2281,20 +2040,7 @@ static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt ...@@ -2281,20 +2040,7 @@ static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt
tNameExtractFullName(&name, dropReq.name); tNameExtractFullName(&name, dropReq.name);
dropReq.igNotExists = pStmt->ignoreNotExists; dropReq.igNotExists = pStmt->ignoreNotExists;
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); return buildCmdMsg(pCxt, TDMT_MND_DROP_TOPIC, (FSerializeFunc)tSerializeSMDropTopicReq, &dropReq);
if (NULL == pCxt->pCmdMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
pCxt->pCmdMsg->msgType = TDMT_MND_DROP_TOPIC;
pCxt->pCmdMsg->msgLen = tSerializeSMDropTopicReq(NULL, 0, &dropReq);
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
if (NULL == pCxt->pCmdMsg->pMsg) {
return TSDB_CODE_OUT_OF_MEMORY;
}
tSerializeSMDropTopicReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
return TSDB_CODE_SUCCESS;
} }
static int32_t translateAlterLocal(STranslateContext* pCxt, SAlterLocalStmt* pStmt) { static int32_t translateAlterLocal(STranslateContext* pCxt, SAlterLocalStmt* pStmt) {
...@@ -2313,6 +2059,19 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) ...@@ -2313,6 +2059,19 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt)
return getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); return getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta);
} }
static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) {
SKillConnReq killReq = {0};
killReq.connId = pStmt->targetId;
return buildCmdMsg(pCxt, TDMT_MND_KILL_CONN, (FSerializeFunc)tSerializeSKillQueryReq, &killReq);
}
static int32_t translateKillQuery(STranslateContext* pCxt, SKillStmt* pStmt) {
SKillQueryReq killReq = {0};
killReq.queryId = pStmt->targetId;
return buildCmdMsg(pCxt, TDMT_MND_KILL_QUERY, (FSerializeFunc)tSerializeSKillQueryReq, &killReq);
}
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pNode)) { switch (nodeType(pNode)) {
...@@ -2407,6 +2166,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { ...@@ -2407,6 +2166,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case QUERY_NODE_DESCRIBE_STMT: case QUERY_NODE_DESCRIBE_STMT:
code = translateDescribe(pCxt, (SDescribeStmt*)pNode); code = translateDescribe(pCxt, (SDescribeStmt*)pNode);
break; break;
case QUERY_NODE_KILL_CONNECTION_STMT:
code = translateKillConnection(pCxt, (SKillStmt*)pNode);
break;
case QUERY_NODE_KILL_QUERY_STMT:
code = translateKillQuery(pCxt, (SKillStmt*)pNode);
break;
default: default:
break; break;
} }
...@@ -2520,6 +2285,34 @@ static void destroyTranslateContext(STranslateContext* pCxt) { ...@@ -2520,6 +2285,34 @@ static void destroyTranslateContext(STranslateContext* pCxt) {
taosHashCleanup(pCxt->pTables); taosHashCleanup(pCxt->pTables);
} }
static const char* getSysDbName(ENodeType type) {
switch (type) {
case QUERY_NODE_SHOW_DATABASES_STMT:
case QUERY_NODE_SHOW_TABLES_STMT:
case QUERY_NODE_SHOW_STABLES_STMT:
case QUERY_NODE_SHOW_USERS_STMT:
case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_VGROUPS_STMT:
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
case QUERY_NODE_SHOW_QNODES_STMT:
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
case QUERY_NODE_SHOW_INDEXES_STMT:
case QUERY_NODE_SHOW_STREAMS_STMT:
case QUERY_NODE_SHOW_BNODES_STMT:
case QUERY_NODE_SHOW_SNODES_STMT:
case QUERY_NODE_SHOW_LICENCE_STMT:
return TSDB_INFORMATION_SCHEMA_DB;
case QUERY_NODE_SHOW_APPS_STMT:
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
case QUERY_NODE_SHOW_QUERIES_STMT:
return TSDB_PERFORMANCE_SCHEMA_DB;
default:
break;
}
return NULL;
}
static const char* getSysTableName(ENodeType type) { static const char* getSysTableName(ENodeType type) {
switch (type) { switch (type) {
case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_DATABASES_STMT:
...@@ -2552,6 +2345,10 @@ static const char* getSysTableName(ENodeType type) { ...@@ -2552,6 +2345,10 @@ static const char* getSysTableName(ENodeType type) {
return TSDB_INS_TABLE_SNODES; return TSDB_INS_TABLE_SNODES;
case QUERY_NODE_SHOW_LICENCE_STMT: case QUERY_NODE_SHOW_LICENCE_STMT:
return TSDB_INS_TABLE_LICENCES; return TSDB_INS_TABLE_LICENCES;
case QUERY_NODE_SHOW_APPS_STMT:
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
case QUERY_NODE_SHOW_QUERIES_STMT:
// todo
default: default:
break; break;
} }
...@@ -2570,7 +2367,7 @@ static int32_t createSelectStmtForShow(ENodeType showType, SSelectStmt** pStmt) ...@@ -2570,7 +2367,7 @@ static int32_t createSelectStmtForShow(ENodeType showType, SSelectStmt** pStmt)
nodesDestroyNode(pSelect); nodesDestroyNode(pSelect);
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
strcpy(pTable->table.dbName, TSDB_INFORMATION_SCHEMA_DB); strcpy(pTable->table.dbName, getSysDbName(showType));
strcpy(pTable->table.tableName, getSysTableName(showType)); strcpy(pTable->table.tableName, getSysTableName(showType));
strcpy(pTable->table.tableAlias, pTable->table.tableName); strcpy(pTable->table.tableAlias, pTable->table.tableName);
pSelect->pFromTable = (SNode*)pTable; pSelect->pFromTable = (SNode*)pTable;
...@@ -3074,6 +2871,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { ...@@ -3074,6 +2871,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
case QUERY_NODE_SHOW_STREAMS_STMT: case QUERY_NODE_SHOW_STREAMS_STMT:
case QUERY_NODE_SHOW_BNODES_STMT: case QUERY_NODE_SHOW_BNODES_STMT:
case QUERY_NODE_SHOW_SNODES_STMT: case QUERY_NODE_SHOW_SNODES_STMT:
case QUERY_NODE_SHOW_APPS_STMT:
case QUERY_NODE_SHOW_CONNECTIONS_STMT:
case QUERY_NODE_SHOW_QUERIES_STMT:
code = rewriteShow(pCxt, pQuery); code = rewriteShow(pCxt, pQuery);
break; break;
case QUERY_NODE_CREATE_TABLE_STMT: case QUERY_NODE_CREATE_TABLE_STMT:
......
...@@ -498,19 +498,16 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren ...@@ -498,19 +498,16 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
SDataBlockDescNode* pLeftDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc;
SDataBlockDescNode* pRightDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 1))->pOutputDataBlockDesc;
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
pJoin->joinType = pJoinLogicNode->joinType; pJoin->joinType = pJoinLogicNode->joinType;
if (NULL != pJoinLogicNode->pOnConditions) { if (NULL != pJoinLogicNode->pOnConditions) {
SDataBlockDescNode* pLeftDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc;
SDataBlockDescNode* pRightDesc = ((SPhysiNode*)nodesListGetNode(pChildren, 1))->pOutputDataBlockDesc;
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pOnConditions, &pJoin->pOnConditions); code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pOnConditions, &pJoin->pOnConditions);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pJoin->pTargets = nodesCloneList(pJoinLogicNode->node.pTargets); code = setListSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->node.pTargets, &pJoin->pTargets);
if (NULL == pJoin->pTargets) {
code = TSDB_CODE_OUT_OF_MEMORY;
}
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = addDataBlockSlots(pCxt, pJoin->pTargets, pJoin->node.pOutputDataBlockDesc); code = addDataBlockSlots(pCxt, pJoin->pTargets, pJoin->node.pOutputDataBlockDesc);
......
...@@ -180,11 +180,11 @@ TEST_F(PlannerTest, selectStableBasic) { ...@@ -180,11 +180,11 @@ TEST_F(PlannerTest, selectStableBasic) {
TEST_F(PlannerTest, selectJoin) { TEST_F(PlannerTest, selectJoin) {
setDatabase("root", "test"); setDatabase("root", "test");
// bind("SELECT t1.c1, t2.c2 FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); bind("SELECT t1.c1, t2.c2 FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts");
// ASSERT_TRUE(run()); ASSERT_TRUE(run());
// bind("SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); bind("SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts");
// ASSERT_TRUE(run()); ASSERT_TRUE(run());
bind("SELECT t1.c1, t2.c1 FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts where t1.c1 > t2.c1 and t1.c2 = 'abc' and t2.c2 = 'qwe'"); bind("SELECT t1.c1, t2.c1 FROM st1s1 t1 join st1s2 t2 on t1.ts = t2.ts where t1.c1 > t2.c1 and t1.c2 = 'abc' and t2.c2 = 'qwe'");
ASSERT_TRUE(run()); ASSERT_TRUE(run());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册