Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
375847ca
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看板
提交
375847ca
编写于
7月 16, 2021
作者:
W
wpan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support nchar filter
上级
87564679
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
127 addition
and
3 deletion
+127
-3
src/query/src/qFilter.c
src/query/src/qFilter.c
+88
-3
tests/script/general/parser/condition.sim
tests/script/general/parser/condition.sim
+39
-0
未找到文件。
src/query/src/qFilter.c
浏览文件 @
375847ca
...
...
@@ -1470,7 +1470,7 @@ _err_return:
return
TSDB_CODE_SUCCESS
;
}
int32_t
filter
Generate
GroupFromArray
(
SFilterInfo
*
info
,
SArray
*
group
)
{
int32_t
filter
Convert
GroupFromArray
(
SFilterInfo
*
info
,
SArray
*
group
)
{
size_t
groupSize
=
taosArrayGetSize
(
group
);
info
->
groupNum
=
(
uint16_t
)
groupSize
;
...
...
@@ -1488,6 +1488,89 @@ int32_t filterGenerateGroupFromArray(SFilterInfo *info, SArray* group) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
filterCheckRangeCoverage
(
SFilterInfo
*
info
,
SFilterGroupCtx
*
gctx
,
SFilterGroupCtx
**
uctx
)
{
if
(
gctx
->
num
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
SFilterInfo
oinfo
=
*
info
;
uint16_t
gNum
=
0
;
SArray
*
group
=
taosArrayInit
(
FILTER_DEFAULT_GROUP_SIZE
,
sizeof
(
SFilterGroup
));
memset
(
info
,
0
,
sizeof
(
*
info
));
filterInitUnitsFields
(
info
);
for
(
uint16_t
i
=
0
;
i
<
oinfo
.
groupNum
;
++
i
)
{
SFilterGroup
*
g
=
oinfo
.
groups
+
i
;
SFilterGroup
ng
=
{
0
};
uint16_t
unitNum
=
(
uctx
&&
uctx
[
i
])
?
uctx
[
i
]
->
num
:
g
->
unitNum
;
if
(
unitNum
==
0
)
{
continue
;
}
++
gNum
;
if
((
uctx
==
NULL
)
||
(
uctx
[
i
]
==
NULL
))
{
for
(
uint16_t
n
=
0
;
n
<
g
->
unitNum
;
++
n
)
{
SFilterUnit
*
u
=
FILTER_GROUP_UNIT
(
&
oinfo
,
g
,
n
);
filterAddUnitFromUnit
(
info
,
&
oinfo
,
u
);
filterAddUnitToGroup
(
&
ng
,
info
->
unitNum
-
1
);
}
taosArrayPush
(
group
,
&
ng
);
continue
;
}
SFilterGroupCtx
*
ctx
=
uctx
[
i
];
for
(
uint16_t
n
=
0
;
n
<
g
->
unitNum
;
++
n
)
{
SFilterUnit
*
u
=
FILTER_GROUP_UNIT
(
&
oinfo
,
g
,
n
);
int32_t
type
=
FILTER_UNIT_DATA_TYPE
(
u
);
if
(
FILTER_NO_MERGE_DATA_TYPE
(
type
))
{
filterAddUnitFromUnit
(
info
,
&
oinfo
,
u
);
filterAddUnitToGroup
(
&
ng
,
info
->
unitNum
-
1
);
continue
;
}
uint16_t
cidx
=
FILTER_UNIT_COL_IDX
(
u
);
assert
(
ctx
->
col
[
cidx
]
>
0
||
ctx
->
col
[
cidx
]
==
-
1
);
if
(
ctx
->
col
[
cidx
]
!=
-
1
)
{
filterAddUnitFromUnit
(
info
,
&
oinfo
,
u
);
filterAddUnitToGroup
(
&
ng
,
info
->
unitNum
-
1
);
}
}
if
(
ctx
->
colRange
&&
taosArrayGetSize
(
ctx
->
colRange
)
>
0
)
{
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
ctx
->
colRange
);
for
(
int32_t
m
=
0
;
m
<
size
;
++
m
)
{
SFilterColRange
*
cra
=
taosArrayGet
(
ctx
->
colRange
,
m
);
filterAddGroupUnitFromRange
(
info
,
&
oinfo
,
cra
,
&
ng
,
TSDB_RELATION_AND
,
NULL
);
}
}
taosArrayPush
(
group
,
&
ng
);
}
if
(
gctx
->
colRange
&&
taosArrayGetSize
(
gctx
->
colRange
)
>
0
)
{
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
gctx
->
colRange
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SFilterColRange
*
cra
=
taosArrayGet
(
gctx
->
colRange
,
i
);
filterAddGroupUnitFromRange
(
info
,
&
oinfo
,
cra
,
NULL
,
TSDB_RELATION_OR
,
group
);
}
}
filterConvertGroupFromArray
(
info
,
group
);
taosArrayDestroy
(
group
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
filterRewrite
(
SFilterInfo
*
info
,
SFilterGroupCtx
*
gctx
,
SFilterGroupCtx
**
uctx
)
{
if
(
gctx
->
num
==
0
)
{
...
...
@@ -1564,7 +1647,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx* gctx, SFilterGroupCtx*
}
}
filter
Generate
GroupFromArray
(
info
,
group
);
filter
Convert
GroupFromArray
(
info
,
group
);
taosArrayDestroy
(
group
);
...
...
@@ -1590,6 +1673,8 @@ int32_t filterPreprocess(SFilterInfo *info) {
return
TSDB_CODE_SUCCESS
;
}
filterCheckRangeCoverage
(
info
,
&
groupRes
,
unitsRes
);
//TODO GET COLUMN RANGE
filterRewrite
(
info
,
&
groupRes
,
unitsRes
);
...
...
@@ -1699,7 +1784,7 @@ int32_t filterInitFromTree(tExprNode* tree, SFilterInfo **pinfo, uint32_t option
ERR_JRET
(
code
);
filter
Generate
GroupFromArray
(
info
,
group
);
filter
Convert
GroupFromArray
(
info
,
group
);
ERR_JRET
(
filterInitValFieldData
(
info
));
...
...
tests/script/general/parser/condition.sim
浏览文件 @
375847ca
...
...
@@ -93,6 +93,12 @@ sql_error select ts,c1,c7 from stb1 where c7 > false
sql_error select * from stb1 where c1 > NULL;
sql_error select * from stb1 where c1 = NULL;
sql_error select * from stb1 where c1 LIKE '%1';
sql_error select * from stb1 where c2 LIKE '%1';
sql_error select * from stb1 where c3 LIKE '%1';
sql_error select * from stb1 where c4 LIKE '%1';
sql_error select * from stb1 where c5 LIKE '%1';
sql_error select * from stb1 where c6 LIKE '%1';
sql_error select * from stb1 where c7 LIKE '%1';
sql_error select * from stb1 where c1 = 'NULL';
sql_error select * from stb1 where c2 > 'NULL';
sql_error select * from stb1 where c3 <> 'NULL';
...
...
@@ -1225,6 +1231,39 @@ if $data20 != @21-05-05 18:19:18.000@ then
return -1
endi
sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42);
if $rows != 1 then
return -1
endi
if $data00 != @21-05-05 18:19:04.000@ then
return -1
endi
sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42');
if $rows != 1 then
return -1
endi
if $data00 != @21-05-05 18:19:04.000@ then
return -1
endi
sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50);
if $rows != 4 then
return -1
endi
if $data00 != @21-05-05 18:19:24.000@ then
return -1
endi
if $data10 != @21-05-05 18:19:25.000@ then
return -1
endi
if $data20 != @21-05-05 18:19:26.000@ then
return -1
endi
if $data30 != @21-05-05 18:19:27.000@ then
return -1
endi
sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52;
if $rows != 4 then
return -1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录