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

fix json compare error

上级 02541454
...@@ -577,10 +577,20 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { ...@@ -577,10 +577,20 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) {
int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) { int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
if (type == TSDB_DATA_TYPE_JSON){ if (type == TSDB_DATA_TYPE_JSON){
bool f1IsNull = (*f1 == TSDB_DATA_TYPE_NCHAR && isNull(f1 + CHAR_BYTES, TSDB_DATA_TYPE_JSON));
bool f2IsNull = (*f2 == TSDB_DATA_TYPE_NCHAR && isNull(f2 + CHAR_BYTES, TSDB_DATA_TYPE_JSON));
if(f1IsNull && f2IsNull){
return 0;
}else if(f1IsNull && !f2IsNull){
return -1;
}else if(!f1IsNull && f2IsNull){
return 1;
}else{
assert(*f1 == *f2); assert(*f1 == *f2);
type = *f1; type = *f1;
f1 = POINTER_SHIFT(f1, CHAR_BYTES); f1 += CHAR_BYTES;
f2 = POINTER_SHIFT(f2, CHAR_BYTES); f2 += CHAR_BYTES;
}
} }
switch (type) { switch (type) {
case TSDB_DATA_TYPE_INT: DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2)); case TSDB_DATA_TYPE_INT: DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册