fix: case issue and bugs
This commit is contained in:
parent
1517fe0ff0
commit
b2fea84a3a
|
@ -37,7 +37,7 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
|
||||||
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
|
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
|
||||||
int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow);
|
int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow);
|
||||||
int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow);
|
int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow);
|
||||||
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray* pPlaceholderValues);
|
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray** pPlaceholderValues);
|
||||||
int32_t translateTable(STranslateContext* pCxt, SNode** pTable);
|
int32_t translateTable(STranslateContext* pCxt, SNode** pTable);
|
||||||
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
|
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
|
||||||
void tfreeSParseQueryRes(void* p);
|
void tfreeSParseQueryRes(void* p);
|
||||||
|
|
|
@ -29,14 +29,14 @@ extern void Parse(void*, int, SToken, void*);
|
||||||
extern void ParseFree(void*, FFree);
|
extern void ParseFree(void*, FFree);
|
||||||
extern void ParseTrace(FILE*, char*);
|
extern void ParseTrace(FILE*, char*);
|
||||||
|
|
||||||
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray* pPlaceholderValues) {
|
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray** pPlaceholderValues) {
|
||||||
*pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY);
|
*pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY);
|
||||||
if (NULL == *pQuery) {
|
if (NULL == *pQuery) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
(*pQuery)->pRoot = pRootNode;
|
(*pQuery)->pRoot = pRootNode;
|
||||||
(*pQuery)->placeholderNum = placeholderNo;
|
(*pQuery)->placeholderNum = placeholderNo;
|
||||||
(*pQuery)->pPlaceholderValues = pPlaceholderValues;
|
TSWAP((*pQuery)->pPlaceholderValues, *pPlaceholderValues);
|
||||||
(*pQuery)->execStage = QUERY_EXEC_STAGE_ANALYSE;
|
(*pQuery)->execStage = QUERY_EXEC_STAGE_ANALYSE;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -91,7 +91,7 @@ int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) {
|
||||||
abort_parse:
|
abort_parse:
|
||||||
ParseFree(pParser, (FFree)taosMemoryFree);
|
ParseFree(pParser, (FFree)taosMemoryFree);
|
||||||
if (TSDB_CODE_SUCCESS == cxt.errCode) {
|
if (TSDB_CODE_SUCCESS == cxt.errCode) {
|
||||||
int32_t code = buildQueryAfterParse(pQuery, cxt.pRootNode, cxt.placeholderNo, cxt.pPlaceholderValues);
|
int32_t code = buildQueryAfterParse(pQuery, cxt.pRootNode, cxt.placeholderNo, &cxt.pPlaceholderValues);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -700,6 +700,14 @@ static int32_t collectMetaKeyFromGrant(SCollectMetaKeyCxt* pCxt, SGrantStmt* pSt
|
||||||
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache);
|
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromRevoke(SCollectMetaKeyCxt* pCxt, SRevokeStmt* pStmt) {
|
||||||
|
if ('\0' == pStmt->tabName[0]) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromCreateViewStmt(SCollectMetaKeyCxt* pCxt, SCreateViewStmt* pStmt) {
|
static int32_t collectMetaKeyFromCreateViewStmt(SCollectMetaKeyCxt* pCxt, SCreateViewStmt* pStmt) {
|
||||||
int32_t code =
|
int32_t code =
|
||||||
reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, pCxt->pMetaCache);
|
reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, pCxt->pMetaCache);
|
||||||
|
@ -760,6 +768,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
||||||
case QUERY_NODE_GRANT_STMT:
|
case QUERY_NODE_GRANT_STMT:
|
||||||
return collectMetaKeyFromGrant(pCxt, (SGrantStmt*)pStmt);
|
return collectMetaKeyFromGrant(pCxt, (SGrantStmt*)pStmt);
|
||||||
|
case QUERY_NODE_REVOKE_STMT:
|
||||||
|
return collectMetaKeyFromRevoke(pCxt, (SRevokeStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
|
|
|
@ -371,7 +371,7 @@ int32_t getTargetMetaImpl(SParseContext* pParCxt, SParseMetaCache* pMetaCache, c
|
||||||
if (pParCxt->async) {
|
if (pParCxt->async) {
|
||||||
code = getTableMetaFromCache(pMetaCache, pName, pMeta);
|
code = getTableMetaFromCache(pMetaCache, pName, pMeta);
|
||||||
#ifdef TD_ENTERPRISE
|
#ifdef TD_ENTERPRISE
|
||||||
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code && couldBeView) {
|
if ((TSDB_CODE_PAR_TABLE_NOT_EXIST == code || TSDB_CODE_PAR_INTERNAL_ERROR == code) && couldBeView) {
|
||||||
int32_t origCode = code;
|
int32_t origCode = code;
|
||||||
code = getViewMetaFromCache(pMetaCache, pName, pMeta);
|
code = getViewMetaFromCache(pMetaCache, pName, pMeta);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
|
|
@ -568,6 +568,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pColList) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pColList) {
|
||||||
code = createColumnByRewriteExprs(pColList, &pJoin->node.pTargets);
|
code = createColumnByRewriteExprs(pColList, &pJoin->node.pTargets);
|
||||||
}
|
}
|
||||||
|
nodesDestroyList(pColList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -587,6 +588,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pColList) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pColList) {
|
||||||
code = createColumnByRewriteExprs(pColList, &pJoin->node.pTargets);
|
code = createColumnByRewriteExprs(pColList, &pJoin->node.pTargets);
|
||||||
}
|
}
|
||||||
|
nodesDestroyList(pColList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == pJoin->node.pTargets && NULL != pLeft) {
|
if (NULL == pJoin->node.pTargets && NULL != pLeft) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
|
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0, 0, 23)
|
tdSql.checkData(0, 0, 24)
|
||||||
tdSql.checkData(0, 1, 'information_schema')
|
tdSql.checkData(0, 1, 'information_schema')
|
||||||
tdSql.checkData(0, 2, None)
|
tdSql.checkData(0, 2, None)
|
||||||
tdSql.checkData(1, 0, 3)
|
tdSql.checkData(1, 0, 3)
|
||||||
|
|
|
@ -58,7 +58,7 @@ endi
|
||||||
|
|
||||||
sql select tbname from information_schema.ins_tables;
|
sql select tbname from information_schema.ins_tables;
|
||||||
print $rows $data00
|
print $rows $data00
|
||||||
if $rows != 32 then
|
if $rows != 33 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data00 != @ins_tables@ then
|
if $data00 != @ins_tables@ then
|
||||||
|
|
|
@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou
|
||||||
if $rows != 3 then
|
if $rows != 3 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data01 != 29 then
|
if $data01 != 30 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data11 != 10 then
|
if $data11 != 10 then
|
||||||
|
@ -72,7 +72,7 @@ endi
|
||||||
if $data11 != 5 then
|
if $data11 != 5 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data21 != 23 then
|
if $data21 != 24 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data31 != 5 then
|
if $data31 != 5 then
|
||||||
|
@ -97,7 +97,7 @@ endi
|
||||||
if $data42 != 3 then
|
if $data42 != 3 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data52 != 23 then
|
if $data52 != 24 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data62 != 5 then
|
if $data62 != 5 then
|
||||||
|
|
|
@ -21,7 +21,7 @@ endi
|
||||||
if $data05 != @select * from sta1;@ then
|
if $data05 != @select * from sta1;@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data06 != @`ts` TIMESTAMP, `f` INT, `g` INT, `t` INT@ then
|
if $data06 != NULL then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data07 != NULL then
|
if $data07 != NULL then
|
||||||
|
@ -30,9 +30,6 @@ endi
|
||||||
if $data08 != NULL then
|
if $data08 != NULL then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data09 != NULL then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql desc view1
|
sql desc view1
|
||||||
if $rows != 4 then
|
if $rows != 4 then
|
||||||
return -1
|
return -1
|
||||||
|
|
Loading…
Reference in New Issue