提交 6c35a930 编写于 作者: M Minglei Jin

fix: backport last expr fix from develop branch

上级 0075d32f
...@@ -2934,7 +2934,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col ...@@ -2934,7 +2934,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
case TSDB_FUNC_LAST: case TSDB_FUNC_LAST:
case TSDB_FUNC_SPREAD: case TSDB_FUNC_SPREAD:
case TSDB_FUNC_LAST_ROW: case TSDB_FUNC_LAST_ROW:
case TSDB_FUNC_INTERP: { case TSDB_FUNC_INTERP: { // link to TD-14196, if add FUNC in this place, please search TD-14196, because there are connection in exprTreeFromSql
bool requireAllFields = (pItem->pNode->Expr.paramList == NULL); bool requireAllFields = (pItem->pNode->Expr.paramList == NULL);
// NOTE: has time range condition or normal column filter condition, the last_row query will be transferred to last query // NOTE: has time range condition or normal column filter condition, the last_row query will be transferred to last query
...@@ -10366,7 +10366,17 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS ...@@ -10366,7 +10366,17 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
*pExpr = calloc(1, sizeof(tExprNode)); *pExpr = calloc(1, sizeof(tExprNode));
(*pExpr)->nodeType = TSQL_NODE_COL; (*pExpr)->nodeType = TSQL_NODE_COL;
(*pExpr)->pSchema = calloc(1, sizeof(SSchema)); (*pExpr)->pSchema = calloc(1, sizeof(SSchema));
if (tsKeepOriginalColumnName && // TD-14196, tsKeepOriginalColumnName params makes logic special
(pSqlExpr->functionId == TSDB_FUNC_FIRST ||
pSqlExpr->functionId == TSDB_FUNC_LAST ||
pSqlExpr->functionId == TSDB_FUNC_SPREAD ||
pSqlExpr->functionId == TSDB_FUNC_LAST_ROW ||
pSqlExpr->functionId == TSDB_FUNC_INTERP)) {
tSqlExprItem* pParamElem = taosArrayGet(pSqlExpr->Expr.paramList, 0);
strncpy((*pExpr)->pSchema->name, pParamElem->pNode->columnName.z, pParamElem->pNode->columnName.n);
}else{
strncpy((*pExpr)->pSchema->name, pSqlExpr->exprToken.z, pSqlExpr->exprToken.n); strncpy((*pExpr)->pSchema->name, pSqlExpr->exprToken.z, pSqlExpr->exprToken.n);
}
// set the input column data byte and type. // set the input column data byte and type.
size_t size = taosArrayGetSize(pQueryInfo->exprList); size_t size = taosArrayGetSize(pQueryInfo->exprList);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册