Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c0c4b5c8
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0c4b5c8
编写于
3月 01, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
5dc9d977
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
123 addition
and
17 deletion
+123
-17
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+8
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+14
-11
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+3
-2
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+81
-2
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+17
-2
未找到文件。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
c0c4b5c8
...
...
@@ -102,6 +102,10 @@ SNode* nodesMakeNode(ENodeType type) {
}
static
EDealRes
destroyNode
(
SNode
**
pNode
,
void
*
pContext
)
{
if
(
NULL
==
pNode
||
NULL
==
*
pNode
)
{
return
DEAL_RES_IGNORE_CHILD
;
}
switch
(
nodeType
(
*
pNode
))
{
case
QUERY_NODE_VALUE
:
{
SValueNode
*
pValue
=
(
SValueNode
*
)
*
pNode
;
...
...
@@ -133,6 +137,10 @@ static EDealRes destroyNode(SNode** pNode, void* pContext) {
}
void
nodesDestroyNode
(
SNode
*
pNode
)
{
if
(
NULL
==
pNode
)
{
return
;
}
nodesRewriteNodePostOrder
(
&
pNode
,
destroyNode
,
NULL
);
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
c0c4b5c8
无法预览此类型文件
source/libs/scalar/src/scalar.c
浏览文件 @
c0c4b5c8
...
...
@@ -793,15 +793,16 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) {
SCL_ERR_JRET
(
TSDB_CODE_QRY_APP_ERROR
);
}
taosHashRemove
(
ctx
.
pRes
,
(
void
*
)
&
pNode
,
POINTER_BYTES
);
sclMoveParamListData
(
res
,
1
,
0
);
*
pDst
=
*
res
;
taosHashRemove
(
ctx
.
pRes
,
(
void
*
)
&
pNode
,
POINTER_BYTES
);
}
_return:
nodesDestroyNode
(
pNode
);
//
nodesDestroyNode(pNode);
sclFreeRes
(
ctx
.
pRes
);
return
code
;
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
c0c4b5c8
...
...
@@ -220,7 +220,7 @@ void flttMakeListNode(SNode **pNode, SNodeList *list, int32_t resType) {
}
TEST
(
timerangeTest
,
greater
)
{
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
,
*
opNode2
=
NULL
,
*
logicNode
=
NULL
;
SNode
*
pcol
=
NULL
,
*
pval
=
NULL
,
*
opNode1
=
NULL
;
bool
eRes
[
5
]
=
{
false
,
false
,
true
,
true
,
true
};
SScalarParam
res
=
{
0
};
int64_t
tsmall
=
222
,
tbig
=
333
;
...
...
@@ -236,6 +236,8 @@ TEST(timerangeTest, greater) {
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
win
.
skey
,
tsmall
);
ASSERT_EQ
(
win
.
ekey
,
INT64_MAX
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode1
);
}
TEST
(
timerangeTest
,
greater_and_lower
)
{
...
...
@@ -263,6 +265,8 @@ TEST(timerangeTest, greater_and_lower) {
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
win
.
skey
,
tsmall
);
ASSERT_EQ
(
win
.
ekey
,
tbig
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode
);
}
...
...
@@ -315,6 +319,10 @@ TEST(columnTest, smallint_column_greater_double_value) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
blockDataDestroy
(
src
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
int_column_greater_smallint_value
)
{
...
...
@@ -366,6 +374,10 @@ TEST(columnTest, int_column_greater_smallint_value) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -408,7 +420,10 @@ TEST(columnTest, int_column_in_double_list) {
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -470,6 +485,10 @@ TEST(columnTest, binary_column_in_binary_list) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -515,6 +534,10 @@ TEST(columnTest, binary_column_like_binary) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -559,6 +582,10 @@ TEST(columnTest, binary_column_is_null) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
TEST
(
columnTest
,
binary_column_is_not_null
)
{
...
...
@@ -602,6 +629,10 @@ TEST(columnTest, binary_column_is_not_null) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -637,6 +668,10 @@ TEST(opTest, smallint_column_greater_int_column) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -672,6 +707,10 @@ TEST(opTest, smallint_value_add_int_column) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -713,6 +752,10 @@ TEST(opTest, bigint_column_multi_binary_column) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
TEST
(
opTest
,
smallint_column_and_binary_column
)
{
...
...
@@ -752,6 +795,10 @@ TEST(opTest, smallint_column_and_binary_column) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
TEST
(
opTest
,
smallint_column_or_float_column
)
{
...
...
@@ -786,6 +833,10 @@ TEST(opTest, smallint_column_or_float_column) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -822,6 +873,10 @@ TEST(opTest, smallint_column_or_double_value) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -863,6 +918,10 @@ TEST(opTest, binary_column_is_true) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
opNode
);
blockDataDestroy
(
src
);
}
...
...
@@ -931,6 +990,10 @@ TEST(filterModelogicTest, diff_columns_and_or_and) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode1
);
blockDataDestroy
(
src
);
}
TEST
(
filterModelogicTest
,
same_column_and_or_and
)
{
...
...
@@ -993,6 +1056,10 @@ TEST(filterModelogicTest, same_column_and_or_and) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode1
);
blockDataDestroy
(
src
);
}
...
...
@@ -1059,6 +1126,10 @@ TEST(filterModelogicTest, diff_columns_or_and_or) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode1
);
blockDataDestroy
(
src
);
}
TEST
(
filterModelogicTest
,
same_column_or_and_or
)
{
...
...
@@ -1121,6 +1192,10 @@ TEST(filterModelogicTest, same_column_or_and_or) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode1
);
blockDataDestroy
(
src
);
}
...
...
@@ -1190,6 +1265,10 @@ TEST(scalarModelogicTest, diff_columns_or_and_or) {
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
ASSERT_EQ
(
*
((
int8_t
*
)
rowRes
+
i
),
eRes
[
i
]);
}
tfree
(
rowRes
);
filterFreeInfo
(
filter
);
nodesDestroyNode
(
logicNode1
);
blockDataDestroy
(
src
);
}
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
c0c4b5c8
...
...
@@ -378,7 +378,8 @@ TEST(constantTest, tinyint_lower_ubigint) {
TEST
(
constantTest
,
usmallint_lower_equal_ubigint
)
{
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
opNode
=
NULL
,
*
res
=
NULL
;
int32_t
leftv
=
1
,
rightv
=
1
;
int32_t
leftv
=
1
;
int64_t
rightv
=
1
;
scltMakeValueNode
(
&
pLeft
,
TSDB_DATA_TYPE_USMALLINT
,
&
leftv
);
scltMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_UBIGINT
,
&
rightv
);
scltMakeOpNode
(
&
opNode
,
OP_TYPE_LOWER_EQUAL
,
TSDB_DATA_TYPE_BOOL
,
pLeft
,
pRight
);
...
...
@@ -395,7 +396,8 @@ TEST(constantTest, usmallint_lower_equal_ubigint) {
TEST
(
constantTest
,
int_equal_smallint1
)
{
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
opNode
=
NULL
,
*
res
=
NULL
;
int32_t
leftv
=
1
,
rightv
=
1
;
int32_t
leftv
=
1
;
int16_t
rightv
=
1
;
scltMakeValueNode
(
&
pLeft
,
TSDB_DATA_TYPE_INT
,
&
leftv
);
scltMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_SMALLINT
,
&
rightv
);
scltMakeOpNode
(
&
opNode
,
OP_TYPE_EQUAL
,
TSDB_DATA_TYPE_BOOL
,
pLeft
,
pRight
);
...
...
@@ -930,6 +932,7 @@ TEST(columnTest, smallint_value_add_int_column) {
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
bigint_column_multi_binary_column
)
{
...
...
@@ -968,6 +971,7 @@ TEST(columnTest, bigint_column_multi_binary_column) {
ASSERT_EQ
(
*
((
double
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
smallint_column_and_binary_column
)
{
...
...
@@ -1005,6 +1009,7 @@ TEST(columnTest, smallint_column_and_binary_column) {
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
smallint_column_or_float_column
)
{
...
...
@@ -1037,6 +1042,7 @@ TEST(columnTest, smallint_column_or_float_column) {
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
smallint_column_or_double_value
)
{
...
...
@@ -1069,6 +1075,7 @@ TEST(columnTest, smallint_column_or_double_value) {
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
smallint_column_greater_double_value
)
{
...
...
@@ -1101,6 +1108,7 @@ TEST(columnTest, smallint_column_greater_double_value) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
int_column_in_double_list
)
{
...
...
@@ -1140,6 +1148,7 @@ TEST(columnTest, int_column_in_double_list) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
binary_column_in_binary_list
)
{
...
...
@@ -1198,6 +1207,7 @@ TEST(columnTest, binary_column_in_binary_list) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
binary_column_like_binary
)
{
...
...
@@ -1242,6 +1252,7 @@ TEST(columnTest, binary_column_like_binary) {
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
...
...
@@ -1282,6 +1293,7 @@ TEST(columnTest, binary_column_is_true) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
binary_column_is_null
)
{
...
...
@@ -1325,6 +1337,7 @@ TEST(columnTest, binary_column_is_null) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
binary_column_is_not_null
)
{
...
...
@@ -1367,6 +1380,7 @@ TEST(columnTest, binary_column_is_not_null) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
opNode
);
}
TEST
(
columnTest
,
greater_and_lower
)
{
...
...
@@ -1408,6 +1422,7 @@ TEST(columnTest, greater_and_lower) {
ASSERT_EQ
(
*
((
bool
*
)
colDataGet
(
column
,
i
)),
eRes
[
i
]);
}
taosArrayDestroyEx
(
blockList
,
scltFreeDataBlock
);
nodesDestroyNode
(
logicNode
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录