[TD-14241]: concat function adoption

This commit is contained in:
Ganlin Zhao 2022-03-30 14:03:54 +08:00
parent 89aba48960
commit 6f6d0e4a09
1 changed files with 18 additions and 2 deletions

View File

@ -508,7 +508,22 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) {
break;
}
case FUNCTION_TYPE_CONCAT:
case FUNCTION_TYPE_CONCAT: {
int32_t paraTypeFirst, totalBytes = 0;
for (int32_t i = 0; i < pFunc->pParameterList->length; ++i) {
SColumnNode* pParam = nodesListGetNode(pFunc->pParameterList, i);
int32_t paraType = pParam->node.resType.type;
if (i == 0) {
paraTypeFirst = paraType;
}
if (paraType != paraTypeFirst) {
return TSDB_CODE_FAILED;
}
totalBytes += pParam->node.resType.bytes;
}
pFunc->node.resType = (SDataType) { .bytes = totalBytes, .type = paraTypeFirst };
break;
}
case FUNCTION_TYPE_CONCAT_WS:
case FUNCTION_TYPE_LOWER:
case FUNCTION_TYPE_UPPER:
@ -517,7 +532,8 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) {
case FUNCTION_TYPE_SUBSTR: {
SColumnNode* pParam = nodesListGetNode(pFunc->pParameterList, 0);
int32_t paraType = pParam->node.resType.type;
pFunc->node.resType = (SDataType) { .bytes = tDataTypes[paraType].bytes, .type = paraType };
//pFunc->node.resType = (SDataType) { .bytes = tDataTypes[paraType].bytes, .type = paraType };
pFunc->node.resType = (SDataType) { .bytes = 23, .type = paraType };
break;
}