Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5ee4a196
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看板
提交
5ee4a196
编写于
7月 09, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): update the ut.
上级
5772b0bb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
18 deletion
+41
-18
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+41
-18
未找到文件。
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
5ee4a196
...
...
@@ -205,13 +205,19 @@ void flttMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) {
*
pNode
=
(
SNode
*
)
lnode
;
}
void
initScalarParam
(
SScalarParam
*
pParam
)
{
memset
(
pParam
,
0
,
sizeof
(
SScalarParam
));
pParam
->
type
=
SHOULD_FREE_COLDATA
;
}
}
TEST
(
timerangeTest
,
greater
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int64_t
tsmall
=
222
,
tbig
=
333
;
flttMakeColumnNode
(
&
pcol
,
NULL
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
0
,
NULL
);
flttMakeValueNode
(
&
pval
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
tsmall
);
...
...
@@ -234,7 +240,8 @@ TEST(timerangeTest, greater) {
TEST
(
timerangeTest
,
greater_and_lower
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int64_t
tsmall
=
222
,
tbig
=
333
;
flttMakeColumnNode
(
&
pcol
,
NULL
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
0
,
NULL
);
flttMakeValueNode
(
&
pval
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
tsmall
);
...
...
@@ -265,7 +272,8 @@ TEST(timerangeTest, greater_and_lower) {
TEST
(
timerangeTest
,
greater_equal_and_lower_equal
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int64_t
tsmall
=
222
,
tbig
=
333
;
flttMakeColumnNode
(
&
pcol
,
NULL
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
int64_t
),
0
,
NULL
);
flttMakeValueNode
(
&
pval
,
TSDB_DATA_TYPE_TIMESTAMP
,
&
tsmall
);
...
...
@@ -297,7 +305,8 @@ TEST(timerangeTest, greater_equal_and_lower_equal) {
TEST
(
timerangeTest
,
greater_and_lower_not_strict
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode1
=
NULL
,
*
logicNode2
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int64_t
tsmall1
=
222
,
tbig1
=
333
;
int64_t
tsmall2
=
444
,
tbig2
=
555
;
SNode
*
list
[
2
]
=
{
0
};
...
...
@@ -350,7 +359,8 @@ TEST(columnTest, smallint_column_greater_double_value) {
double
rightv
=
2.5
;
int8_t
eRes
[
5
]
=
{
0
,
0
,
1
,
1
,
1
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
leftv
)
/
sizeof
(
leftv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
leftv
);
flttMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_DOUBLE
,
&
rightv
);
...
...
@@ -405,7 +415,8 @@ TEST(columnTest, int_column_greater_smallint_value) {
int16_t
rightv
=
4
;
int8_t
eRes
[
5
]
=
{
0
,
0
,
1
,
1
,
1
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
leftv
)
/
sizeof
(
leftv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
),
rowNum
,
leftv
);
flttMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_SMALLINT
,
&
rightv
);
...
...
@@ -460,7 +471,8 @@ TEST(columnTest, int_column_in_double_list) {
double
rightv1
=
1.1
,
rightv2
=
2.2
,
rightv3
=
3.3
;
bool
eRes
[
5
]
=
{
true
,
true
,
true
,
false
,
false
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
leftv
)
/
sizeof
(
leftv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
),
rowNum
,
leftv
);
SNodeList
*
list
=
nodesMakeList
();
...
...
@@ -503,7 +515,8 @@ TEST(columnTest, binary_column_in_binary_list) {
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
listNode
=
NULL
,
*
opNode
=
NULL
;
bool
eRes
[
5
]
=
{
true
,
true
,
false
,
false
,
false
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
char
leftv
[
5
][
5
]
=
{
0
};
char
rightv
[
3
][
5
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
...
...
@@ -567,7 +580,8 @@ TEST(columnTest, binary_column_like_binary) {
char
rightv
[
64
]
=
{
0
};
char
leftv
[
5
][
5
]
=
{
0
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
bool
eRes
[
5
]
=
{
true
,
false
,
true
,
false
,
true
};
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
...
...
@@ -614,7 +628,8 @@ TEST(columnTest, binary_column_is_null) {
SNode
*
pLeft
=
NULL
,
*
opNode
=
NULL
;
char
leftv
[
5
][
5
]
=
{
0
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
false
,
true
};
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
...
...
@@ -661,7 +676,8 @@ TEST(columnTest, binary_column_is_not_null) {
SNode
*
pLeft
=
NULL
,
*
opNode
=
NULL
;
char
leftv
[
5
][
5
]
=
{
0
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
bool
eRes
[
5
]
=
{
true
,
true
,
true
,
true
,
false
};
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
...
...
@@ -710,7 +726,8 @@ TEST(opTest, smallint_column_greater_int_column) {
int32_t
rightv
[
5
]
=
{
0
,
-
5
,
-
4
,
23
,
100
};
bool
eRes
[
5
]
=
{
true
,
false
,
true
,
false
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
rightv
)
/
sizeof
(
rightv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
leftv
);
flttMakeColumnNode
(
&
pRight
,
&
src
,
TSDB_DATA_TYPE_INT
,
sizeof
(
int32_t
),
rowNum
,
rightv
);
...
...
@@ -747,7 +764,8 @@ TEST(opTest, smallint_value_add_int_column) {
int16_t
rightv
[
5
]
=
{
0
,
-
1
,
-
4
,
-
1
,
100
};
bool
eRes
[
5
]
=
{
true
,
false
,
true
,
false
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
rightv
)
/
sizeof
(
rightv
[
0
]);
flttMakeValueNode
(
&
pLeft
,
TSDB_DATA_TYPE_INT
,
&
leftv
);
flttMakeColumnNode
(
&
pRight
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
rightv
);
...
...
@@ -790,7 +808,8 @@ TEST(opTest, bigint_column_multi_binary_column) {
}
bool
eRes
[
5
]
=
{
false
,
true
,
true
,
true
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
rightv
)
/
sizeof
(
rightv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_BIGINT
,
sizeof
(
int64_t
),
rowNum
,
leftv
);
flttMakeColumnNode
(
&
pRight
,
&
src
,
TSDB_DATA_TYPE_BINARY
,
5
,
rowNum
,
rightv
);
...
...
@@ -833,7 +852,8 @@ TEST(opTest, smallint_column_and_binary_column) {
}
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
false
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
rightv
)
/
sizeof
(
rightv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
leftv
);
flttMakeColumnNode
(
&
pRight
,
&
src
,
TSDB_DATA_TYPE_BINARY
,
5
,
rowNum
,
rightv
);
...
...
@@ -871,7 +891,8 @@ TEST(opTest, smallint_column_or_float_column) {
float
rightv
[
5
]
=
{
2.0
,
3.0
,
0
,
5.2
,
6.0
};
bool
eRes
[
5
]
=
{
true
,
true
,
false
,
true
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
rightv
)
/
sizeof
(
rightv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
leftv
);
flttMakeColumnNode
(
&
pRight
,
&
src
,
TSDB_DATA_TYPE_FLOAT
,
sizeof
(
float
),
rowNum
,
rightv
);
...
...
@@ -909,7 +930,8 @@ TEST(opTest, smallint_column_or_double_value) {
double
rightv
=
10.2
;
bool
eRes
[
5
]
=
{
true
,
true
,
true
,
true
,
true
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
int32_t
rowNum
=
sizeof
(
leftv
)
/
sizeof
(
leftv
[
0
]);
flttMakeColumnNode
(
&
pLeft
,
&
src
,
TSDB_DATA_TYPE_SMALLINT
,
sizeof
(
int16_t
),
rowNum
,
leftv
);
flttMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_DOUBLE
,
&
rightv
);
...
...
@@ -945,7 +967,8 @@ TEST(opTest, binary_column_is_true) {
SNode
*
pLeft
=
NULL
,
*
opNode
=
NULL
;
char
leftv
[
5
][
5
]
=
{
0
};
SSDataBlock
*
src
=
NULL
;
SScalarParam
res
=
{.
type
=
SHOULD_FREE_COLDATA
};
SScalarParam
res
;
initScalarParam
(
&
res
);
bool
eRes
[
5
]
=
{
false
,
true
,
false
,
true
,
false
};
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录