提交 d6796258 编写于 作者: wmmhello's avatar wmmhello

fix address sanitazer memory error

上级 5c72ef6b
......@@ -5570,6 +5570,7 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
int jsonIndex = startColId + 1;
char nullTypeKey[VARSTR_HEADER_SIZE + INT_BYTES] = {0};
varDataSetLen(nullTypeKey, INT_BYTES);
nullTypeVal[0] = TSDB_DATA_TYPE_JSON;
varDataSetLen(nullTypeVal + CHAR_BYTES, INT_BYTES);
*(uint32_t*)(varDataVal(nullTypeKey)) = jsonNULL;
tdAddColToKVRow(kvRowBuilder, jsonIndex++, TSDB_DATA_TYPE_NCHAR, nullTypeKey, false); // add json null type
......
......@@ -2961,9 +2961,17 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows,
uint32_t uidx = info->groups[0].unitIdxs[0];
void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i;
if(info->cunits[uidx].dataType == TSDB_DATA_TYPE_JSON){
if(colData) colData += CHAR_BYTES;
if (!colData){ // for json->'key' is null
(*p)[i] = 1;
}else if( *(char*)colData == TSDB_DATA_TYPE_JSON){ // for json is null
colData += CHAR_BYTES;
(*p)[i] = isNull(colData, info->cunits[uidx].dataType);
}else{
(*p)[i] = 0;
}
}else{
(*p)[i] = ((colData == NULL) || isNull(colData, info->cunits[uidx].dataType));
}
(*p)[i] = ((colData == NULL) || isNull(colData, info->cunits[uidx].dataType));
if ((*p)[i] == 0) {
all = false;
}
......@@ -2986,10 +2994,20 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows
for (int32_t i = 0; i < numOfRows; ++i) {
uint32_t uidx = info->groups[0].unitIdxs[0];
void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i;
if(info->cunits[uidx].dataType == TSDB_DATA_TYPE_JSON){
if(colData) colData += CHAR_BYTES;
if (!colData) { // for json->'key' is not null
(*p)[i] = 0;
}else if( *(char*)colData == TSDB_DATA_TYPE_JSON){ // for json is not null
colData += CHAR_BYTES;
(*p)[i] = !isNull(colData, info->cunits[uidx].dataType);
}else{ // for json->'key' is not null
(*p)[i] = 1;
}
}else {
(*p)[i] = ((colData != NULL) && !isNull(colData, info->cunits[uidx].dataType));
}
(*p)[i] = ((colData != NULL) && !isNull(colData, info->cunits[uidx].dataType));
if ((*p)[i] == 0) {
all = false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册