Revert "fix(query): fix cast function regression brought by other changes"

This reverts commit e000addc2c.
This commit is contained in:
Ganlin Zhao 2022-05-09 15:16:47 +08:00
parent 8bbcb02855
commit b3df34ef08
2 changed files with 4 additions and 6 deletions

View File

@ -363,8 +363,10 @@ SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType d
CHECK_OUT_OF_MEM(func); CHECK_OUT_OF_MEM(func);
strcpy(func->functionName, "cast"); strcpy(func->functionName, "cast");
func->node.resType = dt; func->node.resType = dt;
if (TSDB_DATA_TYPE_NCHAR == dt.type) { if (TSDB_DATA_TYPE_VARCHAR == dt.type) {
func->node.resType.bytes = func->node.resType.bytes * TSDB_NCHAR_SIZE; func->node.resType.bytes = func->node.resType.bytes + VARSTR_HEADER_SIZE;
} else if (TSDB_DATA_TYPE_NCHAR == dt.type) {
func->node.resType.bytes = func->node.resType.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
} }
nodesListMakeAppend(&func->pParameterList, pExpr); nodesListMakeAppend(&func->pParameterList, pExpr);
return (SNode*)func; return (SNode*)func;

View File

@ -709,10 +709,6 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
int16_t outputType = GET_PARAM_TYPE(&pOutput[0]); int16_t outputType = GET_PARAM_TYPE(&pOutput[0]);
int64_t outputLen = GET_PARAM_BYTES(&pOutput[0]); int64_t outputLen = GET_PARAM_BYTES(&pOutput[0]);
if (IS_VAR_DATA_TYPE(outputType)) {
outputLen += VARSTR_HEADER_SIZE;
}
char *outputBuf = taosMemoryCalloc(outputLen * pInput[0].numOfRows, 1); char *outputBuf = taosMemoryCalloc(outputLen * pInput[0].numOfRows, 1);
char *output = outputBuf; char *output = outputBuf;