From 2743ac61933f3562bb5687e7c896ff14304d970d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 20 Aug 2022 15:45:56 +0800 Subject: [PATCH] opti: group by tag --- source/libs/executor/src/executil.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 7f61eb678f..8ec1e9b584 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -680,15 +680,24 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis for(int j = 0; j < taosArrayGetSize(groupData); j++){ SColumnInfoData* pValue = (SColumnInfoData*)taosArrayGetP(groupData, j); - ASSERT(pValue->info.type != TSDB_DATA_TYPE_JSON); - - if (pValue->info.type == TSDB_DATA_TYPE_NULL || colDataIsNull_s(pValue, i)) { + if (colDataIsNull_s(pValue, i)) { isNull[j] = 1; - continue; } else { isNull[j] = 0; char* data = colDataGetData(pValue, i); - if (IS_VAR_DATA_TYPE(pValue->info.type)) { + if (pValue->info.type == TSDB_DATA_TYPE_JSON) { + if (tTagIsJson(data)) { + code = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR; + goto end; + } + if(tTagIsJsonNull(data)){ + isNull[j] = 1; + continue; + } + int32_t len = getJsonValueLen(data); + memcpy(pStart, data, len); + pStart += len; + } else if (IS_VAR_DATA_TYPE(pValue->info.type)) { memcpy(pStart, data, varDataTLen(data)); pStart += varDataTLen(data); } else {