fix: a problem of parser async
This commit is contained in:
parent
79d8361a08
commit
d8e89196a6
|
@ -258,6 +258,17 @@ static int32_t collectMetaKeyFromExplain(SCollectMetaKeyCxt* pCxt, SExplainStmt*
|
||||||
return collectMetaKeyFromQuery(pCxt, pStmt->pQuery);
|
return collectMetaKeyFromQuery(pCxt, pStmt->pQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromDescribe(SCollectMetaKeyCxt* pCxt, SDescribeStmt* pStmt) {
|
||||||
|
SName name = {.type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId};
|
||||||
|
strcpy(name.dbname, pStmt->dbName);
|
||||||
|
strcpy(name.tname, pStmt->tableName);
|
||||||
|
int32_t code = catalogRemoveTableMeta(pCxt->pParseCxt->pCatalog, &name);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateStreamStmt* pStmt) {
|
static int32_t collectMetaKeyFromCreateStream(SCollectMetaKeyCxt* pCxt, SCreateStreamStmt* pStmt) {
|
||||||
return collectMetaKeyFromQuery(pCxt, pStmt->pQuery);
|
return collectMetaKeyFromQuery(pCxt, pStmt->pQuery);
|
||||||
}
|
}
|
||||||
|
@ -381,6 +392,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromCreateTopic(pCxt, (SCreateTopicStmt*)pStmt);
|
return collectMetaKeyFromCreateTopic(pCxt, (SCreateTopicStmt*)pStmt);
|
||||||
case QUERY_NODE_EXPLAIN_STMT:
|
case QUERY_NODE_EXPLAIN_STMT:
|
||||||
return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt);
|
return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt);
|
||||||
|
case QUERY_NODE_DESCRIBE_STMT:
|
||||||
|
return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt);
|
||||||
case QUERY_NODE_CREATE_STREAM_STMT:
|
case QUERY_NODE_CREATE_STREAM_STMT:
|
||||||
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
|
|
|
@ -207,6 +207,13 @@ int32_t __catalogGetUdfInfo(SCatalog* pCtg, void* pTrans, const SEpSet* pMgmtEps
|
||||||
return g_mockCatalogService->catalogGetUdfInfo(funcName, pInfo);
|
return g_mockCatalogService->catalogGetUdfInfo(funcName, pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t __catalogRefreshGetTableMeta(SCatalog* pCatalog, void* pTransporter, const SEpSet* pMgmtEps,
|
||||||
|
const SName* pTableName, STableMeta** pTableMeta, int32_t isSTable) {
|
||||||
|
return g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t __catalogRemoveTableMeta(SCatalog* pCtg, SName* pTableName) { return 0; }
|
||||||
|
|
||||||
void initMetaDataEnv() {
|
void initMetaDataEnv() {
|
||||||
g_mockCatalogService.reset(new MockCatalogService());
|
g_mockCatalogService.reset(new MockCatalogService());
|
||||||
|
|
||||||
|
@ -221,6 +228,8 @@ void initMetaDataEnv() {
|
||||||
stub.set(catalogGetDBCfg, __catalogGetDBCfg);
|
stub.set(catalogGetDBCfg, __catalogGetDBCfg);
|
||||||
stub.set(catalogChkAuth, __catalogChkAuth);
|
stub.set(catalogChkAuth, __catalogChkAuth);
|
||||||
stub.set(catalogGetUdfInfo, __catalogGetUdfInfo);
|
stub.set(catalogGetUdfInfo, __catalogGetUdfInfo);
|
||||||
|
stub.set(catalogRefreshGetTableMeta, __catalogRefreshGetTableMeta);
|
||||||
|
stub.set(catalogRemoveTableMeta, __catalogRemoveTableMeta);
|
||||||
// {
|
// {
|
||||||
// AddrAny any("libcatalog.so");
|
// AddrAny any("libcatalog.so");
|
||||||
// std::map<std::string,void*> result;
|
// std::map<std::string,void*> result;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace ParserTest {
|
||||||
|
|
||||||
class ParserInitialDTest : public ParserDdlTest {};
|
class ParserInitialDTest : public ParserDdlTest {};
|
||||||
|
|
||||||
// DELETE FROM tb_name [WHERE condition]
|
// DELETE FROM table_name [WHERE condition]
|
||||||
TEST_F(ParserInitialDTest, delete) {
|
TEST_F(ParserInitialDTest, delete) {
|
||||||
useDb("root", "test");
|
useDb("root", "test");
|
||||||
|
|
||||||
|
@ -40,7 +40,15 @@ TEST_F(ParserInitialDTest, deleteSemanticCheck) {
|
||||||
run("DELETE FROM t1 WHERE c1 > 10", TSDB_CODE_PAR_INVALID_DELETE_WHERE, PARSER_STAGE_TRANSLATE);
|
run("DELETE FROM t1 WHERE c1 > 10", TSDB_CODE_PAR_INVALID_DELETE_WHERE, PARSER_STAGE_TRANSLATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo desc
|
// DESC table_name
|
||||||
|
TEST_F(ParserInitialDTest, describe) {
|
||||||
|
useDb("root", "test");
|
||||||
|
|
||||||
|
run("DESC t1");
|
||||||
|
|
||||||
|
run("DESCRIBE st1");
|
||||||
|
}
|
||||||
|
|
||||||
// todo describe
|
// todo describe
|
||||||
// todo DROP account
|
// todo DROP account
|
||||||
|
|
||||||
|
|
|
@ -50,11 +50,13 @@ class ParserDdlTest : public ParserTestBase {
|
||||||
|
|
||||||
virtual void checkDdl(const SQuery* pQuery, ParserStage stage) {
|
virtual void checkDdl(const SQuery* pQuery, ParserStage stage) {
|
||||||
ASSERT_NE(pQuery, nullptr);
|
ASSERT_NE(pQuery, nullptr);
|
||||||
ASSERT_EQ(pQuery->haveResultSet, false);
|
|
||||||
ASSERT_NE(pQuery->pRoot, nullptr);
|
ASSERT_NE(pQuery->pRoot, nullptr);
|
||||||
ASSERT_EQ(pQuery->numOfResCols, 0);
|
if (QUERY_EXEC_MODE_RPC == pQuery->execMode) {
|
||||||
ASSERT_EQ(pQuery->pResSchema, nullptr);
|
ASSERT_EQ(pQuery->haveResultSet, false);
|
||||||
ASSERT_EQ(pQuery->precision, 0);
|
ASSERT_EQ(pQuery->numOfResCols, 0);
|
||||||
|
ASSERT_EQ(pQuery->pResSchema, nullptr);
|
||||||
|
ASSERT_EQ(pQuery->precision, 0);
|
||||||
|
}
|
||||||
if (nullptr != checkDdl_) {
|
if (nullptr != checkDdl_) {
|
||||||
checkDdl_(pQuery, stage);
|
checkDdl_(pQuery, stage);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue