fix(query): set proper ltrim/rtrim result schema bytes

TD-18431
This commit is contained in:
Ganlin Zhao 2022-08-17 11:25:32 +08:00
parent cca1cacd35
commit b58402ba3b
1 changed files with 4 additions and 1 deletions

View File

@ -323,7 +323,10 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
int32_t numOfSpaces = 0; int32_t numOfSpaces = 0;
SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0); SNode* pParamNode1 = nodesListGetNode(pFunc->pParameterList, 0);
if (nodeType(pParamNode1) != QUERY_NODE_VALUE) { // for select trim functions with constant value from table,
// need to set the proper result result schema bytes to avoid
// trailing garbage characters
if (nodeType(pParamNode1) == QUERY_NODE_VALUE) {
SValueNode* pValue = (SValueNode*)pParamNode1; SValueNode* pValue = (SValueNode*)pParamNode1;
numOfSpaces = countTrailingSpaces(pValue, isLtrim); numOfSpaces = countTrailingSpaces(pValue, isLtrim);
} }