Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac169b8d
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看板
提交
ac169b8d
编写于
7月 30, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix index bugf
上级
c0003de3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
106 addition
and
93 deletion
+106
-93
include/common/ttypes.h
include/common/ttypes.h
+80
-81
include/util/types.h
include/util/types.h
+4
-4
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+2
-2
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+2
-1
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+2
-2
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+16
-3
未找到文件。
include/common/ttypes.h
浏览文件 @
ac169b8d
...
...
@@ -143,84 +143,84 @@ typedef struct {
} \
} while (0)
#define SET_TYPED_DATA_MIN(_v, _type)
\
do {
\
switch (_type) {
\
case TSDB_DATA_TYPE_BOOL:
\
case TSDB_DATA_TYPE_TINYINT:
\
*(int8_t *)(_v) = INT8_MIN;
\
break;
\
case TSDB_DATA_TYPE_SMALLINT:
\
*(int16_t *)(_v) = INT16_MIN;
\
break;
\
case TSDB_DATA_TYPE_INT:
\
*(int32_t *)(_v) = INT32_MIN;
\
break;
\
case TSDB_DATA_TYPE_BIGINT:
\
case TSDB_DATA_TYPE_TIMESTAMP:
\
*(int64_t *)(_v) = INT64_MIN;
\
break;
\
case TSDB_DATA_TYPE_FLOAT:
\
*(float *)(_v) = FLT_MIN;
\
break;
\
case TSDB_DATA_TYPE_DOUBLE:
\
*(double *)(_v) = DBL_MIN;
\
break;
\
case TSDB_DATA_TYPE_UTINYINT:
\
*(uint8_t *)(_v) = 0;
\
break;
\
case TSDB_DATA_TYPE_USMALLINT:
\
*(uint16_t *)(_v) = 0;
\
break;
\
case TSDB_DATA_TYPE_UBIGINT:
\
*(uint64_t *)(_v) = 0;
\
break;
\
case TSDB_DATA_TYPE_UINT:
\
*(uint32_t *)(_v) = 0;
\
break;
\
default:
\
break;
\
}
\
#define SET_TYPED_DATA_MIN(_v, _type) \
do { \
switch (_type) { \
case TSDB_DATA_TYPE_BOOL: \
case TSDB_DATA_TYPE_TINYINT: \
*(int8_t *)(_v) = INT8_MIN; \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
*(int16_t *)(_v) = INT16_MIN; \
break; \
case TSDB_DATA_TYPE_INT: \
*(int32_t *)(_v) = INT32_MIN; \
break; \
case TSDB_DATA_TYPE_BIGINT: \
case TSDB_DATA_TYPE_TIMESTAMP: \
*(int64_t *)(_v) = INT64_MIN; \
break; \
case TSDB_DATA_TYPE_FLOAT: \
*(float *)(_v) = FLT_MIN; \
break; \
case TSDB_DATA_TYPE_DOUBLE: \
*(double *)(_v) = DBL_MIN; \
break; \
case TSDB_DATA_TYPE_UTINYINT: \
*(uint8_t *)(_v) = 0; \
break; \
case TSDB_DATA_TYPE_USMALLINT: \
*(uint16_t *)(_v) = 0; \
break; \
case TSDB_DATA_TYPE_UBIGINT: \
*(uint64_t *)(_v) = 0; \
break; \
case TSDB_DATA_TYPE_UINT: \
*(uint32_t *)(_v) = 0; \
break; \
default: \
break; \
} \
} while (0)
#define SET_TYPED_DATA_MAX(_v, _type)
\
do {
\
switch (_type) {
\
case TSDB_DATA_TYPE_BOOL:
\
case TSDB_DATA_TYPE_TINYINT:
\
*(int8_t *)(_v) = INT8_MAX;
\
break;
\
case TSDB_DATA_TYPE_SMALLINT:
\
*(int16_t *)(_v) = INT16_MAX;
\
break;
\
case TSDB_DATA_TYPE_INT:
\
*(int32_t *)(_v) = INT32_MAX;
\
break;
\
case TSDB_DATA_TYPE_BIGINT:
\
case TSDB_DATA_TYPE_TIMESTAMP:
\
*(int64_t *)(_v) = INT64_MAX;
\
break;
\
case TSDB_DATA_TYPE_FLOAT:
\
*(float *)(_v) = FLT_MAX;
\
break;
\
case TSDB_DATA_TYPE_DOUBLE:
\
*(double *)(_v) = DBL_MAX;
\
break;
\
case TSDB_DATA_TYPE_UTINYINT:
\
*(uint8_t *)(_v) = UINT8_MAX;
\
break;
\
case TSDB_DATA_TYPE_USMALLINT:
\
*(uint16_t *)(_v) = UINT16_MAX;
\
break;
\
case TSDB_DATA_TYPE_UINT:
\
*(uint32_t *)(_v) = UINT32_MAX;
\
break;
\
case TSDB_DATA_TYPE_UBIGINT:
\
*(uint64_t *)(_v) = UINT64_MAX;
\
break;
\
default:
\
break;
\
}
\
#define SET_TYPED_DATA_MAX(_v, _type) \
do { \
switch (_type) { \
case TSDB_DATA_TYPE_BOOL: \
case TSDB_DATA_TYPE_TINYINT: \
*(int8_t *)(_v) = INT8_MAX; \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
*(int16_t *)(_v) = INT16_MAX; \
break; \
case TSDB_DATA_TYPE_INT: \
*(int32_t *)(_v) = INT32_MAX; \
break; \
case TSDB_DATA_TYPE_BIGINT: \
case TSDB_DATA_TYPE_TIMESTAMP: \
*(int64_t *)(_v) = INT64_MAX; \
break; \
case TSDB_DATA_TYPE_FLOAT: \
*(float *)(_v) = FLT_MAX; \
break; \
case TSDB_DATA_TYPE_DOUBLE: \
*(double *)(_v) = DBL_MAX; \
break; \
case TSDB_DATA_TYPE_UTINYINT: \
*(uint8_t *)(_v) = UINT8_MAX; \
break; \
case TSDB_DATA_TYPE_USMALLINT: \
*(uint16_t *)(_v) = UINT16_MAX; \
break; \
case TSDB_DATA_TYPE_UINT: \
*(uint32_t *)(_v) = UINT32_MAX; \
break; \
case TSDB_DATA_TYPE_UBIGINT: \
*(uint64_t *)(_v) = UINT64_MAX; \
break; \
default: \
break; \
} \
} while (0)
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \
...
...
@@ -260,10 +260,9 @@ typedef struct {
} \
} while (0)
//TODO: use varchar(0) to represent NULL type
#define IS_VAR_NULL_TYPE(_t, _b) ((_t) == TSDB_DATA_TYPE_VARCHAR && (_b) == 0)
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
// TODO: use varchar(0) to represent NULL type
#define IS_VAR_NULL_TYPE(_t, _b) ((_t) == TSDB_DATA_TYPE_VARCHAR && (_b) == 0)
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
...
...
@@ -329,7 +328,7 @@ typedef struct tDataTypeDescriptor {
int16_t
type
;
int16_t
nameLen
;
int32_t
bytes
;
char
*
name
;
char
*
name
;
int64_t
minValue
;
int64_t
maxValue
;
int32_t
(
*
compFunc
)(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
...
...
include/util/types.h
浏览文件 @
ac169b8d
...
...
@@ -81,11 +81,11 @@ static FORCE_INLINE double taos_align_get_double(const char *pBuf) {
typedef
uint16_t
VarDataLenT
;
// maxVarDataLen: 32767
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataVal(v) ((char *)(v) + VARSTR_HEADER_SIZE)
#define varDataLen(v)
((VarDataLenT *)(v))[0]
#define varDataVal(v)
((char *)(v) + VARSTR_HEADER_SIZE)
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
#define NCHAR_WIDTH_TO_BYTES(n)
((n) *
TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE)
#define NCHAR_WIDTH_TO_BYTES(n)
((n)*
TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE)
typedef
int32_t
VarDataOffsetT
;
...
...
@@ -98,4 +98,4 @@ typedef struct tstr {
}
#endif
#endif
/*_TD_TYPES_H_*/
\ No newline at end of file
#endif
/*_TD_TYPES_H_*/
source/dnode/vnode/inc/vnode.h
浏览文件 @
ac169b8d
...
...
@@ -89,13 +89,13 @@ void metaReaderClear(SMetaReader *pReader);
int32_t
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int32_t
metaReadNext
(
SMetaReader
*
pReader
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
type
,
STagVal
*
tagVal
);
int
metaGetTableNameByUid
(
void
*
meta
,
uint64_t
uid
,
char
*
tbName
);
int
metaGetTableNameByUid
(
void
*
meta
,
uint64_t
uid
,
char
*
tbName
);
typedef
struct
SMetaFltParam
{
tb_uid_t
suid
;
int16_t
cid
;
int16_t
type
;
char
*
val
;
void
*
val
;
bool
reverse
;
int
(
*
filterFunc
)(
void
*
a
,
void
*
b
,
int16_t
type
);
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
ac169b8d
...
...
@@ -315,7 +315,8 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL
return
1
;
}
else
if
(
!
pTagIdxKey1
->
isNull
&&
!
pTagIdxKey2
->
isNull
)
{
// all not NULL, compr tag vals
c
=
doCompare
(
pTagIdxKey1
->
data
,
pTagIdxKey2
->
data
,
pTagIdxKey1
->
type
,
0
);
__compar_fn_t
func
=
getComparFunc
(
pTagIdxKey1
->
type
,
0
);
c
=
func
(
pTagIdxKey1
->
data
,
pTagIdxKey2
->
data
);
if
(
c
)
return
c
;
}
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
ac169b8d
...
...
@@ -98,9 +98,9 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name) {
return
uid
;
}
int
metaGetTableNameByUid
(
void
*
meta
,
uint64_t
uid
,
char
*
tbName
)
{
int
metaGetTableNameByUid
(
void
*
meta
,
uint64_t
uid
,
char
*
tbName
)
{
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
(
SMeta
*
)
meta
,
0
);
metaReaderInit
(
&
mr
,
(
SMeta
*
)
meta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
uid
);
STR_TO_VARSTR
(
tbName
,
mr
.
me
.
name
);
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
ac169b8d
...
...
@@ -385,14 +385,27 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
.
reverse
=
reverse
,
.
filterFunc
=
filterFunc
};
char
buf
[
128
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
float
f
=
0
.
0
;
if
(
IS_VAR_DATA_TYPE
(
left
->
colValType
))
{
if
(
!
IS_VAR_DATA_TYPE
(
right
->
colValType
))
{
NUM_TO_STRING
(
right
->
colValType
,
right
->
condValue
,
sizeof
(
buf
),
buf
+
VARSTR_HEADER_SIZE
);
NUM_TO_STRING
(
right
->
colValType
,
right
->
condValue
,
sizeof
(
buf
)
-
2
,
buf
+
VARSTR_HEADER_SIZE
);
varDataSetLen
(
buf
,
strlen
(
buf
+
VARSTR_HEADER_SIZE
));
param
.
val
=
buf
;
}
}
else
{
if
(
left
->
colValType
==
TSDB_DATA_TYPE_FLOAT
)
{
if
(
right
->
colValType
==
TSDB_DATA_TYPE_DOUBLE
)
{
f
=
GET_DOUBLE_VAL
(
right
->
condValue
);
param
.
val
=
&
f
;
}
else
if
(
right
->
colValType
==
TSDB_DATA_TYPE_BIGINT
)
{
f
=
*
(
int64_t
*
)(
right
->
condValue
);
param
.
val
=
&
f
;
}
else
{
f
=
*
(
int32_t
*
)(
right
->
condValue
);
param
.
val
=
&
f
;
}
}
}
ret
=
metaFilterTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录