Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7eec493a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
7eec493a
编写于
2月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
compare
上级
3e49b78a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
118 addition
and
166 deletion
+118
-166
include/common/tcompare.h
include/common/tcompare.h
+0
-40
include/common/ttypes.h
include/common/ttypes.h
+0
-5
include/util/tcompare.h
include/util/tcompare.h
+9
-1
include/util/types.h
include/util/types.h
+5
-0
source/common/src/tcompare.c
source/common/src/tcompare.c
+0
-111
source/common/src/tep.c
source/common/src/tep.c
+1
-1
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+3
-2
source/libs/wal/inc/walInt.h
source/libs/wal/inc/walInt.h
+1
-1
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+1
-1
source/util/src/tcompare.c
source/util/src/tcompare.c
+96
-2
source/util/src/thashutil.c
source/util/src/thashutil.c
+1
-1
source/util/src/tskiplist.c
source/util/src/tskiplist.c
+1
-1
未找到文件。
include/common/tcompare.h
已删除
100644 → 0
浏览文件 @
3e49b78a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_TCOMPARE_H_
#define _TD_TCOMPARE_H_
#include "compare.h"
#include "ttypes.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
compareStrPatternMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
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
);
__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
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TCOMPARE_H_*/
include/common/ttypes.h
浏览文件 @
7eec493a
...
...
@@ -15,11 +15,6 @@ typedef uint8_t TDRowValT;
typedef
uint16_t
col_id_t
;
typedef
int8_t
col_type_t
;
typedef
struct
tstr
{
VarDataLenT
len
;
char
data
[];
}
tstr
;
#pragma pack(push, 1)
typedef
struct
{
VarDataLenT
len
;
...
...
include/util/compare.h
→
include/util/
t
compare.h
浏览文件 @
7eec493a
...
...
@@ -17,12 +17,12 @@
#define _TD_UTIL_COMPARE_H_
#include "os.h"
#include "taos.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define TSDB_PATTERN_MATCH 0
#define TSDB_PATTERN_NOMATCH 1
#define TSDB_PATTERN_NOWILDCARDMATCH 2
...
...
@@ -99,7 +99,15 @@ int32_t compareUint64ValDesc(const void *pLeft, const void *pRight);
int32_t
compareLenPrefixedStrDesc
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareLenPrefixedWStrDesc
(
const
void
*
pLeft
,
const
void
*
pRight
);
int32_t
compareStrPatternMatch
(
const
void
*
pLeft
,
const
void
*
pRight
);
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
);
__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
);
#ifdef __cplusplus
}
...
...
include/util/types.h
浏览文件 @
7eec493a
...
...
@@ -81,6 +81,11 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
typedef
int32_t
VarDataOffsetT
;
typedef
struct
tstr
{
VarDataLenT
len
;
char
data
[];
}
tstr
;
#ifdef __cplusplus
}
#endif
...
...
source/common/src/tcompare.c
已删除
100644 → 0
浏览文件 @
3e49b78a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tcompare.h"
__compar_fn_t
getKeyComparFunc
(
int32_t
keyType
,
int32_t
order
)
{
__compar_fn_t
comparFn
=
NULL
;
switch
(
keyType
)
{
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt8Val
:
compareInt8ValDesc
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt16Val
:
compareInt16ValDesc
;
break
;
case
TSDB_DATA_TYPE_INT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt32Val
:
compareInt32ValDesc
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt64Val
:
compareInt64ValDesc
;
break
;
case
TSDB_DATA_TYPE_FLOAT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareFloatVal
:
compareFloatValDesc
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareDoubleVal
:
compareDoubleValDesc
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint8Val
:
compareUint8ValDesc
;
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint16Val
:
compareUint16ValDesc
;
break
;
case
TSDB_DATA_TYPE_UINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint32Val
:
compareUint32ValDesc
;
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint64Val
:
compareUint64ValDesc
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareLenPrefixedStr
:
compareLenPrefixedStrDesc
;
break
;
case
TSDB_DATA_TYPE_NCHAR
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareLenPrefixedWStr
:
compareLenPrefixedWStrDesc
;
break
;
default:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt32Val
:
compareInt32ValDesc
;
break
;
}
return
comparFn
;
}
int32_t
doCompare
(
const
char
*
f1
,
const
char
*
f2
,
int32_t
type
,
size_t
size
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
DEFAULT_COMP
(
GET_INT32_VAL
(
f1
),
GET_INT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_DOUBLE
:
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
case
TSDB_DATA_TYPE_FLOAT
:
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
case
TSDB_DATA_TYPE_BIGINT
:
DEFAULT_COMP
(
GET_INT64_VAL
(
f1
),
GET_INT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_NCHAR
:
{
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
int32_t
ret
=
memcmp
((
wchar_t
*
)
t1
,
(
wchar_t
*
)
t2
,
t2
->
len
);
if
(
ret
==
0
)
{
return
ret
;
}
return
(
ret
<
0
)
?
-
1
:
1
;
}
default:
{
// todo refactor
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
else
{
int32_t
ret
=
strncmp
(
t1
->
data
,
t2
->
data
,
t1
->
len
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
ret
<
0
?
-
1
:
1
;
}
}
}
}
}
source/common/src/tep.c
浏览文件 @
7eec493a
#include "tep.h"
#include
<compare.h>
#include
"tcompare.h"
#include "common.h"
#include "tglobal.h"
#include "tlockfree.h"
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
7eec493a
...
...
@@ -12,8 +12,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <tglobal.h>
#include "os.h"
#include "tglobal.h"
#include "tcompare.h"
#include "taosdef.h"
#include "tcompare.h"
...
...
source/libs/wal/inc/walInt.h
浏览文件 @
7eec493a
...
...
@@ -16,7 +16,7 @@
#ifndef _TD_WAL_INT_H_
#define _TD_WAL_INT_H_
#include "compare.h"
#include "
t
compare.h"
#include "taoserror.h"
#include "tchecksum.h"
#include "tcoding.h"
...
...
source/libs/wal/src/walMgmt.c
浏览文件 @
7eec493a
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "compare.h"
#include "
t
compare.h"
#include "os.h"
#include "taoserror.h"
#include "tfile.h"
...
...
source/util/src/compare.c
→
source/util/src/
t
compare.c
浏览文件 @
7eec493a
...
...
@@ -16,9 +16,8 @@
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "compare.h"
#include "
t
compare.h"
#include "regex.h"
#include "thash.h"
#include "types.h"
...
...
@@ -574,3 +573,98 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
}
__compar_fn_t
getKeyComparFunc
(
int32_t
keyType
,
int32_t
order
)
{
__compar_fn_t
comparFn
=
NULL
;
switch
(
keyType
)
{
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt8Val
:
compareInt8ValDesc
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt16Val
:
compareInt16ValDesc
;
break
;
case
TSDB_DATA_TYPE_INT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt32Val
:
compareInt32ValDesc
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt64Val
:
compareInt64ValDesc
;
break
;
case
TSDB_DATA_TYPE_FLOAT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareFloatVal
:
compareFloatValDesc
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareDoubleVal
:
compareDoubleValDesc
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint8Val
:
compareUint8ValDesc
;
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint16Val
:
compareUint16ValDesc
;
break
;
case
TSDB_DATA_TYPE_UINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint32Val
:
compareUint32ValDesc
;
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareUint64Val
:
compareUint64ValDesc
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareLenPrefixedStr
:
compareLenPrefixedStrDesc
;
break
;
case
TSDB_DATA_TYPE_NCHAR
:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareLenPrefixedWStr
:
compareLenPrefixedWStrDesc
;
break
;
default:
comparFn
=
(
order
==
TSDB_ORDER_ASC
)
?
compareInt32Val
:
compareInt32ValDesc
;
break
;
}
return
comparFn
;
}
int32_t
doCompare
(
const
char
*
f1
,
const
char
*
f2
,
int32_t
type
,
size_t
size
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
DEFAULT_COMP
(
GET_INT32_VAL
(
f1
),
GET_INT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_DOUBLE
:
DEFAULT_DOUBLE_COMP
(
GET_DOUBLE_VAL
(
f1
),
GET_DOUBLE_VAL
(
f2
));
case
TSDB_DATA_TYPE_FLOAT
:
DEFAULT_FLOAT_COMP
(
GET_FLOAT_VAL
(
f1
),
GET_FLOAT_VAL
(
f2
));
case
TSDB_DATA_TYPE_BIGINT
:
DEFAULT_COMP
(
GET_INT64_VAL
(
f1
),
GET_INT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_SMALLINT
:
DEFAULT_COMP
(
GET_INT16_VAL
(
f1
),
GET_INT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_BOOL
:
DEFAULT_COMP
(
GET_INT8_VAL
(
f1
),
GET_INT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_UTINYINT
:
DEFAULT_COMP
(
GET_UINT8_VAL
(
f1
),
GET_UINT8_VAL
(
f2
));
case
TSDB_DATA_TYPE_USMALLINT
:
DEFAULT_COMP
(
GET_UINT16_VAL
(
f1
),
GET_UINT16_VAL
(
f2
));
case
TSDB_DATA_TYPE_UINT
:
DEFAULT_COMP
(
GET_UINT32_VAL
(
f1
),
GET_UINT32_VAL
(
f2
));
case
TSDB_DATA_TYPE_UBIGINT
:
DEFAULT_COMP
(
GET_UINT64_VAL
(
f1
),
GET_UINT64_VAL
(
f2
));
case
TSDB_DATA_TYPE_NCHAR
:
{
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
int32_t
ret
=
memcmp
((
wchar_t
*
)
t1
,
(
wchar_t
*
)
t2
,
t2
->
len
);
if
(
ret
==
0
)
{
return
ret
;
}
return
(
ret
<
0
)
?
-
1
:
1
;
}
default:
{
// todo refactor
tstr
*
t1
=
(
tstr
*
)
f1
;
tstr
*
t2
=
(
tstr
*
)
f2
;
if
(
t1
->
len
!=
t2
->
len
)
{
return
t1
->
len
>
t2
->
len
?
1
:-
1
;
}
else
{
int32_t
ret
=
strncmp
(
t1
->
data
,
t2
->
data
,
t1
->
len
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
ret
<
0
?
-
1
:
1
;
}
}
}
}
}
source/util/src/thashutil.c
浏览文件 @
7eec493a
...
...
@@ -15,7 +15,7 @@
#include "os.h"
#include "thash.h"
#include "compare.h"
#include "
t
compare.h"
#include "taos.h"
#include "types.h"
...
...
source/util/src/tskiplist.c
浏览文件 @
7eec493a
...
...
@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "compare.h"
#include "
t
compare.h"
#include "tskiplist.h"
#include "tutil.h"
#include "tlog.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录