Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1d5550ae
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看板
未验证
提交
1d5550ae
编写于
8月 09, 2022
作者:
dengyihao
提交者:
GitHub
8月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15826 from taosdata/enh/TD-18139
enh: speed filter with sma result
上级
cfc856ac
2398c9e8
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
99 addition
and
25 deletion
+99
-25
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+99
-25
未找到文件。
source/libs/index/src/indexFilter.c
浏览文件 @
1d5550ae
...
@@ -358,9 +358,101 @@ static Filter sifGetFilterFunc(EIndexQueryType type, bool *reverse) {
...
@@ -358,9 +358,101 @@ static Filter sifGetFilterFunc(EIndexQueryType type, bool *reverse) {
}
}
return
NULL
;
return
NULL
;
}
}
typedef
union
{
uint8_t
u8
;
uint16_t
u16
;
uint32_t
u32
;
uint64_t
u64
;
int8_t
i8
;
int16_t
i16
;
int32_t
i32
;
int64_t
i64
;
double
d
;
float
f
;
}
SDataTypeBuf
;
#define SIF_DATA_CONVERT(type, val, dst) \
do { \
if (type == TSDB_DATA_TYPE_DOUBLE) \
dst = GET_DOUBLE_VAL(val); \
else if (type == TSDB_DATA_TYPE_BIGINT) \
dst = *(int64_t *)val; \
else if (type == TSDB_DATA_TYPE_INT) \
dst = *(int32_t *)val; \
else if (type == TSDB_DATA_TYPE_SMALLINT) \
dst = *(int16_t *)val; \
else if (type == TSDB_DATA_TYPE_TINYINT) \
dst = *(int8_t *)val; \
else if (type == TSDB_DATA_TYPE_UTINYINT) \
dst = *(uint8_t *)val; \
else if (type == TSDB_DATA_TYPE_USMALLINT) \
dst = *(uint16_t *)val; \
else if (type == TSDB_DATA_TYPE_UINT) \
dst = *(uint32_t *)val; \
else if (type == TSDB_DATA_TYPE_UBIGINT) \
dst = *(uint64_t *)val; \
} while (0);
static
void
sifSetFltParam
(
SIFParam
*
left
,
SIFParam
*
right
,
SDataTypeBuf
*
typedata
,
SMetaFltParam
*
param
)
{
int8_t
ltype
=
left
->
colValType
,
rtype
=
right
->
colValType
;
if
(
ltype
==
TSDB_DATA_TYPE_FLOAT
)
{
float
f
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
f
);
typedata
->
f
=
f
;
param
->
val
=
&
typedata
->
f
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
d
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
d
);
typedata
->
d
=
d
;
param
->
val
=
&
typedata
->
d
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_BIGINT
)
{
int64_t
i64
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i64
);
typedata
->
i64
=
i64
;
param
->
val
=
&
typedata
->
i64
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_INT
)
{
int32_t
i32
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i32
);
typedata
->
i32
=
i32
;
param
->
val
=
&
typedata
->
i32
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_SMALLINT
)
{
int16_t
i16
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i16
);
typedata
->
i16
=
i16
;
param
->
val
=
&
typedata
->
i16
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_TINYINT
)
{
int8_t
i8
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i8
)
typedata
->
i8
=
i8
;
param
->
val
=
&
typedata
->
i8
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UBIGINT
)
{
uint64_t
u64
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u64
);
typedata
->
u64
=
u64
;
param
->
val
=
&
typedata
->
u64
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UINT
)
{
uint32_t
u32
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u32
);
typedata
->
u32
=
u32
;
param
->
val
=
&
typedata
->
u32
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_USMALLINT
)
{
uint16_t
u16
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u16
);
typedata
->
u16
=
u16
;
param
->
val
=
&
typedata
->
u16
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UTINYINT
)
{
uint8_t
u8
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u8
);
typedata
->
u8
=
u8
;
param
->
val
=
&
typedata
->
u8
;
}
}
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
int
ret
=
0
;
int
ret
=
0
;
SIndexMetaArg
*
arg
=
&
output
->
arg
;
SIndexMetaArg
*
arg
=
&
output
->
arg
;
EIndexQueryType
qtype
=
0
;
EIndexQueryType
qtype
=
0
;
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
...
@@ -386,8 +478,9 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
...
@@ -386,8 +478,9 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
.
filterFunc
=
filterFunc
};
.
filterFunc
=
filterFunc
};
char
buf
[
128
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
float
f
=
0
.
0
;
double
d
=
0
.
0
;
SDataTypeBuf
typedata
;
memset
(
&
typedata
,
0
,
sizeof
(
typedata
));
if
(
IS_VAR_DATA_TYPE
(
left
->
colValType
))
{
if
(
IS_VAR_DATA_TYPE
(
left
->
colValType
))
{
if
(
!
IS_VAR_DATA_TYPE
(
right
->
colValType
))
{
if
(
!
IS_VAR_DATA_TYPE
(
right
->
colValType
))
{
NUM_TO_STRING
(
right
->
colValType
,
right
->
condValue
,
sizeof
(
buf
)
-
2
,
buf
+
VARSTR_HEADER_SIZE
);
NUM_TO_STRING
(
right
->
colValType
,
right
->
condValue
,
sizeof
(
buf
)
-
2
,
buf
+
VARSTR_HEADER_SIZE
);
...
@@ -395,26 +488,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
...
@@ -395,26 +488,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
param
.
val
=
buf
;
param
.
val
=
buf
;
}
}
}
else
{
}
else
{
if
(
left
->
colValType
==
TSDB_DATA_TYPE_FLOAT
)
{
sifSetFltParam
(
left
,
right
,
&
typedata
,
&
param
);
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
;
}
}
else
if
(
left
->
colValType
==
TSDB_DATA_TYPE_DOUBLE
)
{
if
(
right
->
colValType
==
TSDB_DATA_TYPE_DOUBLE
)
{
d
=
GET_DOUBLE_VAL
(
right
->
condValue
);
param
.
val
=
&
d
;
}
else
if
(
right
->
colValType
==
TSDB_DATA_TYPE_BIGINT
)
{
d
=
*
(
int64_t
*
)(
right
->
condValue
);
param
.
val
=
&
d
;
}
}
}
}
ret
=
metaFilterTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
ret
=
metaFilterTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录