提交 75c5de47 编写于 作者: X Xiaoyu Wang

TD-13747 bugfix

上级 54e15db2
...@@ -499,29 +499,37 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) ...@@ -499,29 +499,37 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t setTableVgroupList(STranslateContext *pCxt, SName* name, SVgroupsInfo **pVgList) { static int32_t setTableVgroupList(SParseContext* pCxt, SName* name, SRealTableNode* pRealTable) {
SArray* vgroupList = NULL; if (TSDB_SUPER_TABLE == pRealTable->pMeta->tableType) {
int32_t code = catalogGetTableDistVgInfo(pCxt->pParseCxt->pCatalog, pCxt->pParseCxt->pTransporter, &(pCxt->pParseCxt->mgmtEpSet), name, &vgroupList); SArray* vgroupList = NULL;
if (code != TSDB_CODE_SUCCESS) { int32_t code = catalogGetTableDistVgInfo(pCxt->pCatalog, pCxt->pTransporter, &pCxt->mgmtEpSet, name, &vgroupList);
return code; if (code != TSDB_CODE_SUCCESS) {
} return code;
}
size_t vgroupNum = taosArrayGetSize(vgroupList);
size_t vgroupNum = taosArrayGetSize(vgroupList);
pRealTable->pVgroupList = calloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo) * vgroupNum);
if (NULL == pRealTable->pVgroupList) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pRealTable->pVgroupList->numOfVgroups = vgroupNum;
for (int32_t i = 0; i < vgroupNum; ++i) {
SVgroupInfo *vg = taosArrayGet(vgroupList, i);
pRealTable->pVgroupList->vgroups[i] = *vg;
}
SVgroupsInfo* vgList = calloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo) * vgroupNum); taosArrayDestroy(vgroupList);
if (NULL == vgList) { } else {
return TSDB_CODE_OUT_OF_MEMORY; pRealTable->pVgroupList = calloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
} if (NULL == pRealTable->pVgroupList) {
vgList->numOfVgroups = vgroupNum; return TSDB_CODE_OUT_OF_MEMORY;
}
for (int32_t i = 0; i < vgroupNum; ++i) { pRealTable->pVgroupList->numOfVgroups = 1;
SVgroupInfo *vg = taosArrayGet(vgroupList, i); int32_t code = catalogGetTableHashVgroup(pCxt->pCatalog, pCxt->pTransporter, &pCxt->mgmtEpSet, name, pRealTable->pVgroupList->vgroups);
vgList->vgroups[i] = *vg; if (code != TSDB_CODE_SUCCESS) {
return code;
}
} }
*pVgList = vgList;
taosArrayDestroy(vgroupList);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -536,7 +544,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { ...@@ -536,7 +544,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName);
} }
code = setTableVgroupList(pCxt, &name, &(pRealTable->pVgroupList)); code = setTableVgroupList(pCxt->pParseCxt, &name, pRealTable);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return code; return code;
} }
......
...@@ -177,7 +177,7 @@ if $rows != 3 then ...@@ -177,7 +177,7 @@ if $rows != 3 then
return -1 return -1
endi endi
sql select * from st sql select ts, i from st
if $rows != 15 then if $rows != 15 then
return -1 return -1
endi endi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册