[td-13039] refactor and fix bugs.
This commit is contained in:
parent
024dd9966f
commit
b0a4cc81bf
|
@ -224,7 +224,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
TEST(testCase, build_executor_tree_Test) {
|
||||
const char* msg = "{\n"
|
||||
" \"NodeType\": \"47\",\n"
|
||||
" \"NodeType\": \"48\",\n"
|
||||
" \"Name\": \"PhysiSubplan\",\n"
|
||||
" \"PhysiSubplan\": {\n"
|
||||
" \"Id\": {\n"
|
||||
|
@ -233,15 +233,21 @@ TEST(testCase, build_executor_tree_Test) {
|
|||
" \"SubplanId\": \"0\"\n"
|
||||
" },\n"
|
||||
" \"SubplanType\": \"0\",\n"
|
||||
" \"MsgType\": \"0\",\n"
|
||||
" \"MsgType\": \"515\",\n"
|
||||
" \"Level\": \"0\",\n"
|
||||
" \"NodeAddr\": {\n"
|
||||
" \"Id\": \"0\",\n"
|
||||
" \"Id\": \"1\",\n"
|
||||
" \"InUse\": \"0\",\n"
|
||||
" \"NumOfEps\": \"0\"\n"
|
||||
" \"NumOfEps\": \"1\",\n"
|
||||
" \"Eps\": [\n"
|
||||
" {\n"
|
||||
" \"Fqdn\": \"node1\",\n"
|
||||
" \"Port\": \"6030\"\n"
|
||||
" }\n"
|
||||
" ]\n"
|
||||
" },\n"
|
||||
" \"RootNode\": {\n"
|
||||
" \"NodeType\": \"40\",\n"
|
||||
" \"NodeType\": \"41\",\n"
|
||||
" \"Name\": \"PhysiProject\",\n"
|
||||
" \"PhysiProject\": {\n"
|
||||
" \"OutputDataBlockDesc\": {\n"
|
||||
|
@ -345,7 +351,7 @@ TEST(testCase, build_executor_tree_Test) {
|
|||
" },\n"
|
||||
" \"Children\": [\n"
|
||||
" {\n"
|
||||
" \"NodeType\": \"37\",\n"
|
||||
" \"NodeType\": \"38\",\n"
|
||||
" \"Name\": \"PhysiTableScan\",\n"
|
||||
" \"PhysiTableScan\": {\n"
|
||||
" \"OutputDataBlockDesc\": {\n"
|
||||
|
@ -825,7 +831,7 @@ TEST(testCase, build_executor_tree_Test) {
|
|||
" }\n"
|
||||
" },\n"
|
||||
" \"DataSink\": {\n"
|
||||
" \"NodeType\": \"45\",\n"
|
||||
" \"NodeType\": \"46\",\n"
|
||||
" \"Name\": \"PhysiDispatch\",\n"
|
||||
" \"PhysiDispatch\": {\n"
|
||||
" \"InputDataBlockDesc\": {\n"
|
||||
|
|
|
@ -58,6 +58,10 @@ int32_t __catalogGetTableHashVgroup(struct SCatalog* pCatalog, void *pRpc, const
|
|||
return mockCatalogService->catalogGetTableHashVgroup(pTableName, vgInfo);
|
||||
}
|
||||
|
||||
int32_t __catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const SName* pTableName, SArray** pVgList) {
|
||||
return mockCatalogService->catalogGetTableDistVgInfo(pTableName, pVgList);
|
||||
}
|
||||
|
||||
void initMetaDataEnv() {
|
||||
mockCatalogService.reset(new MockCatalogService());
|
||||
|
||||
|
@ -65,6 +69,8 @@ void initMetaDataEnv() {
|
|||
stub.set(catalogGetHandle, __catalogGetHandle);
|
||||
stub.set(catalogGetTableMeta, __catalogGetTableMeta);
|
||||
stub.set(catalogGetTableHashVgroup, __catalogGetTableHashVgroup);
|
||||
stub.set(catalogGetTableDistVgInfo, __catalogGetTableDistVgInfo);
|
||||
|
||||
{
|
||||
AddrAny any("libcatalog.so");
|
||||
std::map<std::string,void*> result;
|
||||
|
|
|
@ -126,6 +126,19 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t catalogGetTableDistVgInfo(const SName* pTableName, SArray** pVgList) const {
|
||||
SVgroupInfo info = {0};
|
||||
info.vgId = 1;
|
||||
addEpIntoEpSet(&info.epset, "node1", 6030);
|
||||
|
||||
info.hashBegin = 0;
|
||||
info.hashEnd = 1;
|
||||
*pVgList = taosArrayInit(4, sizeof(SVgroupInfo));
|
||||
|
||||
taosArrayPush(*pVgList, &info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TableBuilder& createTableBuilder(const std::string& db, const std::string& tbname, int8_t tableType, int32_t numOfColumns, int32_t numOfTags) {
|
||||
builder_ = TableBuilder::createTableBuilder(tableType, numOfColumns, numOfTags);
|
||||
meta_[db][tbname] = builder_->table();
|
||||
|
@ -313,4 +326,8 @@ int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableM
|
|||
|
||||
int32_t MockCatalogService::catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo) const {
|
||||
return impl_->catalogGetTableHashVgroup(pTableName, vgInfo);
|
||||
}
|
||||
|
||||
int32_t MockCatalogService::catalogGetTableDistVgInfo(const SName* pTableName, SArray** pVgList) const {
|
||||
return impl_->catalogGetTableDistVgInfo(pTableName, pVgList);
|
||||
}
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta) const;
|
||||
int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo) const;
|
||||
int32_t catalogGetTableDistVgInfo(const SName* pTableName, SArray** pVgList) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<MockCatalogServiceImpl> impl_;
|
||||
|
|
Loading…
Reference in New Issue