提交 e62315c2 编写于 作者: X Xiaoyu Wang

fix: keepColumnName parameter changes the user alias

上级 d39e34ce
...@@ -51,6 +51,7 @@ typedef struct SExprNode { ...@@ -51,6 +51,7 @@ typedef struct SExprNode {
char userAlias[TSDB_COL_NAME_LEN]; char userAlias[TSDB_COL_NAME_LEN];
SArray* pAssociation; SArray* pAssociation;
bool orderAlias; bool orderAlias;
bool asAlias;
} SExprNode; } SExprNode;
typedef enum EColumnType { typedef enum EColumnType {
......
...@@ -680,6 +680,7 @@ SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) ...@@ -680,6 +680,7 @@ SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias)
pExpr->aliasName[len] = '\0'; pExpr->aliasName[len] = '\0';
strncpy(pExpr->userAlias, pAlias->z, len); strncpy(pExpr->userAlias, pAlias->z, len);
pExpr->userAlias[len] = '\0'; pExpr->userAlias[len] = '\0';
pExpr->asAlias = true;
return pNode; return pNode;
} }
......
...@@ -1579,7 +1579,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu ...@@ -1579,7 +1579,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu
"%s(*) is only supported in SELECTed list", pFunc->functionName); "%s(*) is only supported in SELECTed list", pFunc->functionName);
} }
} }
if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList)) { if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList) && !pFunc->node.asAlias) {
strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias); strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册