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

Merge pull request #10855 from taosdata/fix/TD-14196

TD-14196 fix alias name not equal if tsKeepOriginalColumnName is seted
......@@ -3083,7 +3083,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
case TSDB_FUNC_LAST:
case TSDB_FUNC_SPREAD:
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 exprTreeFromSqlExpr
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
......@@ -10735,14 +10735,23 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
*pExpr = calloc(1, sizeof(tExprNode));
(*pExpr)->nodeType = TSQL_NODE_COL;
(*pExpr)->pSchema = calloc(1, sizeof(SSchema));
strncpy((*pExpr)->pSchema->name, pSqlExpr->exprToken.z, pSqlExpr->exprToken.n);
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);
}
// set the input column data byte and type.
size_t size = taosArrayGetSize(pQueryInfo->exprList);
for (int32_t i = 0; i < size; ++i) {
SExprInfo* p1 = taosArrayGetP(pQueryInfo->exprList, i);
if (strcmp((*pExpr)->pSchema->name, p1->base.aliasName) == 0) {
(*pExpr)->pSchema->type = (uint8_t)p1->base.resType;
(*pExpr)->pSchema->bytes = p1->base.resBytes;
......
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import tdDnodes
from math import inf
class TDTestCase:
def caseDescription(self):
'''
case1<shenglian zhou>: [TD-13946]core dump of sampling binary column so that when result from vnode exceeds INT16_MAX bytes
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self._conn = conn
def run(self):
print("running {}".format(__file__))
tdSql.execute("drop database if exists td14196")
tdSql.execute("create database td14196")
tdSql.execute("use td14196")
tdSql.execute("create table st ( ts timestamp, dint int) tags (t1 int)")
tdSql.execute("create table ct1 using st tags(1)")
tdSql.execute("insert into ct1 values(now, 100)")
tdSql.query("select last(dint)/100 from ct1")
tdSql.checkData(0, 0, 1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册