未验证 提交 c103dd71 编写于 作者: S shenglian-zhou 提交者: GitHub

Merge pull request #11128 from taosdata/szhou/fix/td-14312

TD-14312: set colId of scalar expr to result column ID so that order operator can function correctly
......@@ -1849,8 +1849,6 @@ static int32_t handleScalarTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32
}
}
// expr string is set as the parameter of function
SColumnIndex index = {.tableIndex = tableIndex};
tExprNode* pNode = NULL;
SArray* colList = taosArrayInit(10, sizeof(SColIndex));
......@@ -1889,9 +1887,11 @@ static int32_t handleScalarTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
SColumnIndex index = {.tableIndex = tableIndex};
SExprInfo* pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_SCALAR_EXPR, &index, pNode->resultType, pNode->resultBytes,
getNewResColId(pCmd), 0, false);
// set the colId to the result column id
pExpr->base.colInfo.colId = pExpr->base.resColId;
char* name = (pItem->aliasName != NULL)? pItem->aliasName:pItem->pNode->exprToken.z;
size_t len = MIN(sizeof(pExpr->base.aliasName), pItem->pNode->exprToken.n + 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册