From 40228a00c88a0a65850b29b2ff8893f6708b62bc Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 17 Mar 2022 07:32:28 -0400 Subject: [PATCH] TD-14043 show statement bugfix --- source/libs/nodes/src/nodesCloneFuncs.c | 11 ++++++++++- source/libs/parser/src/parTranslater.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 2c840c84ea..bd4fb4737c 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -111,6 +111,10 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst); COPY_CHAR_POINT_FIELD(literal); COPY_SCALAR_FIELD(isDuration); + COPY_SCALAR_FIELD(translate); + if (!pSrc->translate) { + return (SNode*)pDst; + } switch (pSrc->node.resType.type) { case TSDB_DATA_TYPE_NULL: break; @@ -137,7 +141,12 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: - COPY_CHAR_POINT_FIELD(datum.p); + pDst->datum.p = malloc(pSrc->node.resType.bytes + VARSTR_HEADER_SIZE); + if (NULL == pDst->datum.p) { + nodesDestroyNode(pDst); + return NULL; + } + memcpy(pDst->datum.p, pSrc->datum.p, pSrc->node.resType.bytes + VARSTR_HEADER_SIZE); break; case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_DECIMAL: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 7345b5a7a0..fb796aef81 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1374,7 +1374,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN return TSDB_CODE_OUT_OF_MEMORY; } - pOper->opType = OP_TYPE_LIKE; + pOper->opType = opType; pOper->pLeft = nodesMakeNode(QUERY_NODE_COLUMN); pOper->pRight = nodesCloneNode(pRight); if (NULL == pOper->pLeft || NULL == pOper->pRight) { -- GitLab