Merge pull request #15667 from taosdata/feature/3.0_wxy
fix: alias error for partition by keys
This commit is contained in:
commit
5f3432cfc4
|
@ -81,10 +81,8 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
|||
SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel);
|
||||
taosArrayPush(pTables, &pTable);
|
||||
if (hasSameTableAlias(pTables)) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf,
|
||||
TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||
"Not unique table/alias: '%s'",
|
||||
((STableNode*)pTable)->tableAlias);
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
||||
}
|
||||
} else {
|
||||
do {
|
||||
|
@ -92,10 +90,8 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
|||
if (pCxt->currLevel == currTotalLevel) {
|
||||
taosArrayPush(pTables, &pTable);
|
||||
if (hasSameTableAlias(pTables)) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf,
|
||||
TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||
"Not unique table/alias: '%s'",
|
||||
((STableNode*)pTable)->tableAlias);
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
|
||||
}
|
||||
}
|
||||
taosArrayPush(pCxt->pNsLevel, &pTables);
|
||||
|
@ -1587,6 +1583,7 @@ static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode
|
|||
|
||||
strcpy(pFunc->functionName, "_group_key");
|
||||
strcpy(pFunc->node.aliasName, ((SExprNode*)*pNode)->aliasName);
|
||||
strcpy(pFunc->node.userAlias, ((SExprNode*)*pNode)->userAlias);
|
||||
pCxt->errCode = nodesListMakeAppend(&pFunc->pParameterList, *pNode);
|
||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||
*pNode = (SNode*)pFunc;
|
||||
|
@ -2644,27 +2641,6 @@ static int32_t appendTsForImplicitTsFunc(STranslateContext* pCxt, SSelectStmt* p
|
|||
return pCxt->errCode;
|
||||
}
|
||||
|
||||
typedef struct SRwriteUniqueCxt {
|
||||
STranslateContext* pTranslateCxt;
|
||||
SNode* pExpr;
|
||||
} SRwriteUniqueCxt;
|
||||
|
||||
static EDealRes rewriteSeletcValueFunc(STranslateContext* pCxt, SNode** pNode) {
|
||||
SFunctionNode* pFirst = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
|
||||
if (NULL == pFirst) {
|
||||
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return DEAL_RES_ERROR;
|
||||
}
|
||||
strcpy(pFirst->functionName, "first");
|
||||
TSWAP(pFirst->pParameterList, ((SFunctionNode*)*pNode)->pParameterList);
|
||||
strcpy(pFirst->node.aliasName, ((SExprNode*)*pNode)->aliasName);
|
||||
nodesDestroyNode(*pNode);
|
||||
*pNode = (SNode*)pFirst;
|
||||
pCxt->errCode = fmGetFuncInfo(pFirst, pCxt->msgBuf.buf, pCxt->msgBuf.len);
|
||||
((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs = true;
|
||||
return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR;
|
||||
}
|
||||
|
||||
typedef struct SReplaceOrderByAliasCxt {
|
||||
STranslateContext* pTranslateCxt;
|
||||
SNodeList* pProjectionList;
|
||||
|
|
Loading…
Reference in New Issue