Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3b0679d3
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3b0679d3
编写于
8月 29, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
8月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16445 from taosdata/enh/removeConvert
enh: remove compare type convertion
上级
0941068c
2bf49b0c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
1026 addition
and
17 deletion
+1026
-17
include/util/tcompare.h
include/util/tcompare.h
+91
-0
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+1
-0
source/libs/scalar/inc/sclInt.h
source/libs/scalar/inc/sclInt.h
+1
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+158
-0
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+25
-17
source/util/src/tcompare.c
source/util/src/tcompare.c
+750
-0
未找到文件。
include/util/tcompare.h
浏览文件 @
3b0679d3
...
...
@@ -105,6 +105,97 @@ int32_t compareStrPatternNotMatch(const void *pLeft, const void *pRight);
int32_t
compareWStrPatternMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareWStrPatternNotMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt8Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt16Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt32Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareInt64Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatInt8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatInt16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatInt32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatInt64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatDouble
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatUint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatUint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatUint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareFloatUint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleInt8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleInt16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleInt32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleInt64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleFloat
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleUint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleUint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleUint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareDoubleUint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint8Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint16Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint32Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Int8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Int16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Int32
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Int64
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Float
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Double
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareUint64Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
);
__compar_fn_t
getComparFunc
(
int32_t
type
,
int32_t
optr
);
__compar_fn_t
getKeyComparFunc
(
int32_t
keyType
,
int32_t
order
);
int32_t
doCompare
(
const
char
*
a
,
const
char
*
b
,
int32_t
type
,
size_t
size
);
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
3b0679d3
...
...
@@ -350,6 +350,7 @@ struct SFilterInfo {
extern
bool
filterDoCompare
(
__compar_fn_t
func
,
uint8_t
optr
,
void
*
left
,
void
*
right
);
extern
__compar_fn_t
filterGetCompFunc
(
int32_t
type
,
int32_t
optr
);
extern
__compar_fn_t
filterGetCompFuncEx
(
int32_t
lType
,
int32_t
rType
,
int32_t
optr
);
#ifdef __cplusplus
}
...
...
source/libs/scalar/inc/sclInt.h
浏览文件 @
3b0679d3
...
...
@@ -47,6 +47,7 @@ typedef struct SScalarCtx {
#define SCL_IS_NULL_VALUE_NODE(_node) ((QUERY_NODE_VALUE == nodeType(_node)) && (TSDB_DATA_TYPE_NULL == ((SValueNode *)_node)->node.resType.type))
#define SCL_IS_COMPARISON_OPERATOR(_opType) ((_opType) >= OP_TYPE_GREATER_THAN && (_opType) < OP_TYPE_IS_NOT_UNKNOWN)
#define SCL_DOWNGRADE_DATETYPE(_type) ((_type) == TSDB_DATA_TYPE_BIGINT || TSDB_DATA_TYPE_DOUBLE == (_type) || (_type) == TSDB_DATA_TYPE_UBIGINT)
#define SCL_NO_NEED_CONVERT_COMPARISION(_ltype, _rtype, _optr) (IS_NUMERIC_TYPE(_ltype) && IS_NUMERIC_TYPE(_rtype) && ((_optr) >= OP_TYPE_GREATER_THAN && (_optr) <= OP_TYPE_NOT_EQUAL))
#define sclFatal(...) qFatal(__VA_ARGS__)
#define sclError(...) qError(__VA_ARGS__)
...
...
source/libs/scalar/src/filter.c
浏览文件 @
3b0679d3
...
...
@@ -132,6 +132,77 @@ __compar_fn_t gDataCompare[] = {compareInt32Val, compareInt8Val, compareInt16Val
compareChkNotInString
,
compareStrPatternNotMatch
,
compareWStrPatternNotMatch
};
__compar_fn_t
gInt8SignCompare
[]
=
{
compareInt8Val
,
compareInt8Int16
,
compareInt8Int32
,
compareInt8Int64
,
compareInt8Float
,
compareInt8Double
};
__compar_fn_t
gInt8UsignCompare
[]
=
{
compareInt8Uint8
,
compareInt8Uint16
,
compareInt8Uint32
,
compareInt8Uint64
};
__compar_fn_t
gInt16SignCompare
[]
=
{
compareInt16Int8
,
compareInt16Val
,
compareInt16Int32
,
compareInt16Int64
,
compareInt16Float
,
compareInt16Double
};
__compar_fn_t
gInt16UsignCompare
[]
=
{
compareInt16Uint8
,
compareInt16Uint16
,
compareInt16Uint32
,
compareInt16Uint64
};
__compar_fn_t
gInt32SignCompare
[]
=
{
compareInt32Int8
,
compareInt32Int16
,
compareInt32Val
,
compareInt32Int64
,
compareInt32Float
,
compareInt32Double
};
__compar_fn_t
gInt32UsignCompare
[]
=
{
compareInt32Uint8
,
compareInt32Uint16
,
compareInt32Uint32
,
compareInt32Uint64
};
__compar_fn_t
gInt64SignCompare
[]
=
{
compareInt64Int8
,
compareInt64Int16
,
compareInt64Int32
,
compareInt64Val
,
compareInt64Float
,
compareInt64Double
};
__compar_fn_t
gInt64UsignCompare
[]
=
{
compareInt64Uint8
,
compareInt64Uint16
,
compareInt64Uint32
,
compareInt64Uint64
};
__compar_fn_t
gFloatSignCompare
[]
=
{
compareFloatInt8
,
compareFloatInt16
,
compareFloatInt32
,
compareFloatInt64
,
compareFloatVal
,
compareFloatDouble
};
__compar_fn_t
gFloatUsignCompare
[]
=
{
compareFloatUint8
,
compareFloatUint16
,
compareFloatUint32
,
compareFloatUint64
};
__compar_fn_t
gDoubleSignCompare
[]
=
{
compareDoubleInt8
,
compareDoubleInt16
,
compareDoubleInt32
,
compareDoubleInt64
,
compareDoubleFloat
,
compareDoubleVal
};
__compar_fn_t
gDoubleUsignCompare
[]
=
{
compareDoubleUint8
,
compareDoubleUint16
,
compareDoubleUint32
,
compareDoubleUint64
};
__compar_fn_t
gUint8SignCompare
[]
=
{
compareUint8Int8
,
compareUint8Int16
,
compareUint8Int32
,
compareUint8Int64
,
compareUint8Float
,
compareUint8Double
};
__compar_fn_t
gUint8UsignCompare
[]
=
{
compareUint8Val
,
compareUint8Uint16
,
compareUint8Uint32
,
compareUint8Uint64
};
__compar_fn_t
gUint16SignCompare
[]
=
{
compareUint16Int8
,
compareUint16Int16
,
compareUint16Int32
,
compareUint16Int64
,
compareUint16Float
,
compareUint16Double
};
__compar_fn_t
gUint16UsignCompare
[]
=
{
compareUint16Uint8
,
compareUint16Val
,
compareUint16Uint32
,
compareUint16Uint64
};
__compar_fn_t
gUint32SignCompare
[]
=
{
compareUint32Int8
,
compareUint32Int16
,
compareUint32Int32
,
compareUint32Int64
,
compareUint32Float
,
compareUint32Double
};
__compar_fn_t
gUint32UsignCompare
[]
=
{
compareUint32Uint8
,
compareUint32Uint16
,
compareUint32Val
,
compareUint32Uint64
};
__compar_fn_t
gUint64SignCompare
[]
=
{
compareUint64Int8
,
compareUint64Int16
,
compareUint64Int32
,
compareUint64Int64
,
compareUint64Float
,
compareUint64Double
};
__compar_fn_t
gUint64UsignCompare
[]
=
{
compareUint64Uint8
,
compareUint64Uint16
,
compareUint64Uint32
,
compareUint64Val
};
int8_t
filterGetCompFuncIdx
(
int32_t
type
,
int32_t
optr
)
{
int8_t
comparFn
=
0
;
...
...
@@ -257,6 +328,93 @@ __compar_fn_t filterGetCompFunc(int32_t type, int32_t optr) {
return
gDataCompare
[
filterGetCompFuncIdx
(
type
,
optr
)];
}
__compar_fn_t
filterGetCompFuncEx
(
int32_t
lType
,
int32_t
rType
,
int32_t
optr
)
{
switch
(
lType
)
{
case
TSDB_DATA_TYPE_TINYINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gInt8SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gInt8UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gInt16SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gInt16UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gInt32SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gInt32UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gInt64SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gInt64UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gFloatSignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gFloatUsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gDoubleSignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gDoubleUsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gUint8SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gUint8UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gUint16SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gUint16UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gUint32SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gUint32UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
rType
)
||
IS_FLOAT_TYPE
(
rType
))
{
return
gUint64SignCompare
[
rType
-
TSDB_DATA_TYPE_TINYINT
];
}
else
{
return
gUint64UsignCompare
[
rType
-
TSDB_DATA_TYPE_UTINYINT
];
}
break
;
}
default:
break
;
}
return
NULL
;
}
static
FORCE_INLINE
int32_t
filterCompareGroupCtx
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
SFilterGroupCtx
*
left
=
*
((
SFilterGroupCtx
**
)
pLeft
),
*
right
=
*
((
SFilterGroupCtx
**
)
pRight
);
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
3b0679d3
...
...
@@ -909,11 +909,11 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut, int32_t*
int8_t
gConvertTypes
[
TSDB_DATA_TYPE_BLOB
+
1
][
TSDB_DATA_TYPE_BLOB
+
1
]
=
{
/* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */
/*NULL*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/*BOOL*/
0
,
0
,
0
,
3
,
4
,
5
,
6
,
7
,
7
,
9
,
7
,
0
,
12
,
13
,
14
,
0
,
7
,
0
,
0
,
/*BOOL*/
0
,
0
,
2
,
3
,
4
,
5
,
6
,
7
,
7
,
9
,
7
,
11
,
12
,
13
,
14
,
0
,
7
,
0
,
0
,
/*TINY*/
0
,
0
,
0
,
3
,
4
,
5
,
6
,
7
,
7
,
9
,
7
,
3
,
4
,
5
,
7
,
0
,
7
,
0
,
0
,
/*SMAL*/
0
,
0
,
0
,
0
,
4
,
5
,
6
,
7
,
7
,
9
,
7
,
3
,
4
,
5
,
7
,
0
,
7
,
0
,
0
,
/*INT */
0
,
0
,
0
,
0
,
0
,
5
,
6
,
7
,
7
,
9
,
7
,
4
,
4
,
5
,
7
,
0
,
7
,
0
,
0
,
/*BIGI*/
0
,
0
,
0
,
0
,
0
,
0
,
6
,
7
,
7
,
0
,
7
,
5
,
5
,
5
,
7
,
0
,
7
,
0
,
0
,
/*BIGI*/
0
,
0
,
0
,
0
,
0
,
0
,
6
,
7
,
7
,
9
,
7
,
5
,
5
,
5
,
7
,
0
,
7
,
0
,
0
,
/*FLOA*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
6
,
7
,
6
,
6
,
6
,
6
,
0
,
7
,
0
,
0
,
/*DOUB*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
0
,
7
,
0
,
0
,
/*VARC*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
9
,
8
,
7
,
7
,
7
,
7
,
0
,
0
,
0
,
0
,
...
...
@@ -1681,10 +1681,14 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
void
vectorCompareImpl
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
,
int32_t
optr
)
{
int32_t
i
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
0
:
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
)
-
1
;
int32_t
step
=
((
_ord
)
==
TSDB_ORDER_ASC
)
?
1
:
-
1
;
int32_t
lType
=
GET_PARAM_TYPE
(
pLeft
);
int32_t
rType
=
GET_PARAM_TYPE
(
pRight
);
__compar_fn_t
fp
=
NULL
;
__compar_fn_t
fp
=
filterGetCompFunc
(
GET_PARAM_TYPE
(
pLeft
),
optr
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
){
return
;
if
(
lType
==
rType
)
{
fp
=
filterGetCompFunc
(
lType
,
optr
);
}
else
{
fp
=
filterGetCompFuncEx
(
lType
,
rType
,
optr
);
}
pOut
->
numOfRows
=
TMAX
(
pLeft
->
numOfRows
,
pRight
->
numOfRows
);
...
...
@@ -1716,12 +1720,15 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
void
vectorCompare
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
,
int32_t
optr
)
{
SScalarParam
pLeftOut
=
{
0
};
SScalarParam
pRightOut
=
{
0
};
vectorConvert
(
pLeft
,
pRight
,
&
pLeftOut
,
&
pRightOut
);
SScalarParam
*
param1
=
NULL
;
SScalarParam
*
param2
=
NULL
;
if
(
SCL_NO_NEED_CONVERT_COMPARISION
(
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
optr
))
{
param1
=
pLeft
;
param2
=
pRight
;
}
else
{
vectorConvert
(
pLeft
,
pRight
,
&
pLeftOut
,
&
pRightOut
);
if
(
pLeftOut
.
columnData
!=
NULL
)
{
param1
=
&
pLeftOut
;
}
else
{
...
...
@@ -1733,6 +1740,7 @@ void vectorCompare(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
}
else
{
param2
=
pRight
;
}
}
vectorCompareImpl
(
param1
,
param2
,
pOut
,
_ord
,
optr
);
sclFreeParam
(
&
pLeftOut
);
...
...
source/util/src/tcompare.c
浏览文件 @
3b0679d3
...
...
@@ -247,6 +247,756 @@ int32_t compareJsonVal(const void *pLeft, const void *pRight) {
}
}
int32_t
compareInt8Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt8Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int8_t
left
=
GET_INT32_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt16Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int16_t
left
=
GET_INT32_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt32Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int32_t
left
=
GET_INT32_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareInt64Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
int64_t
left
=
GET_INT64_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatInt8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatInt16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatInt32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatInt64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatDouble
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
isnan
(
left
)
&&
isnan
(
right
))
{
return
0
;
}
if
(
isnan
(
left
))
{
return
-
1
;
}
if
(
isnan
(
right
))
{
return
1
;
}
if
(
FLT_EQUAL
(
left
,
right
))
{
return
0
;
}
return
FLT_GREATER
(
left
,
right
)
?
1
:
-
1
;
}
int32_t
compareFloatUint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatUint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatUint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareFloatUint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
float
left
=
GET_FLOAT_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleInt8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleInt16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleInt32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleInt64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleFloat
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
isnan
(
left
)
&&
isnan
(
right
))
{
return
0
;
}
if
(
isnan
(
left
))
{
return
-
1
;
}
if
(
isnan
(
right
))
{
return
1
;
}
if
(
FLT_EQUAL
(
left
,
right
))
{
return
0
;
}
return
FLT_GREATER
(
left
,
right
)
?
1
:
-
1
;
}
int32_t
compareDoubleUint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleUint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleUint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareDoubleUint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
double
left
=
GET_DOUBLE_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint8Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint8_t
left
=
GET_UINT8_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint16Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint16_t
left
=
GET_UINT16_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint32Uint64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint32_t
left
=
GET_UINT32_VAL
(
pLeft
);
uint64_t
right
=
GET_UINT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Int8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
int8_t
right
=
GET_INT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Int16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
int16_t
right
=
GET_INT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Int32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
int32_t
right
=
GET_INT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Int64
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
int64_t
right
=
GET_INT64_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Float
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
float
right
=
GET_FLOAT_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Double
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
double
right
=
GET_DOUBLE_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Uint8
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
uint8_t
right
=
GET_UINT8_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Uint16
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
uint16_t
right
=
GET_UINT16_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareUint64Uint32
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
uint64_t
left
=
GET_UINT64_VAL
(
pLeft
);
uint32_t
right
=
GET_UINT32_VAL
(
pRight
);
if
(
left
>
right
)
return
1
;
if
(
left
<
right
)
return
-
1
;
return
0
;
}
int32_t
compareJsonValDesc
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
return
compareJsonVal
(
pRight
,
pLeft
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录