Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
69e9f697
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看板
提交
69e9f697
编写于
5月 12, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
other: add some missing modification files to git.
上级
4eaf1f5b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
106 deletion
+5
-106
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+5
-106
未找到文件。
source/libs/function/src/texpr.c
浏览文件 @
69e9f697
...
...
@@ -64,21 +64,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
}
int32_t
type
=
(
*
pExpr
)
->
nodeType
;
if
(
type
==
TEXPR_BINARYEXPR_NODE
)
{
doExprTreeDestroy
(
&
(
*
pExpr
)
->
_node
.
pLeft
,
fp
);
doExprTreeDestroy
(
&
(
*
pExpr
)
->
_node
.
pRight
,
fp
);
if
(
fp
!=
NULL
)
{
fp
((
*
pExpr
)
->
_node
.
info
);
}
}
else
if
(
type
==
TEXPR_UNARYEXPR_NODE
)
{
doExprTreeDestroy
(
&
(
*
pExpr
)
->
_node
.
pLeft
,
fp
);
if
(
fp
!=
NULL
)
{
fp
((
*
pExpr
)
->
_node
.
info
);
}
assert
((
*
pExpr
)
->
_node
.
pRight
==
NULL
);
}
else
if
(
type
==
TEXPR_VALUE_NODE
)
{
if
(
type
==
TEXPR_VALUE_NODE
)
{
taosVariantDestroy
((
*
pExpr
)
->
pVal
);
taosMemoryFree
((
*
pExpr
)
->
pVal
);
}
else
if
(
type
==
TEXPR_COL_NODE
)
{
...
...
@@ -90,9 +76,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
}
bool
exprTreeApplyFilter
(
tExprNode
*
pExpr
,
const
void
*
pItem
,
SExprTraverseSupp
*
param
)
{
tExprNode
*
pLeft
=
pExpr
->
_node
.
pLeft
;
tExprNode
*
pRight
=
pExpr
->
_node
.
pRight
;
#if 0
//non-leaf nodes, recursively traverse the expression tree in the post-root order
if (pLeft->nodeType == TEXPR_BINARYEXPR_NODE && pRight->nodeType == TEXPR_BINARYEXPR_NODE) {
if (pExpr->_node.optr == LOGIC_COND_TYPE_OR) { // or
...
...
@@ -114,6 +98,9 @@ bool exprTreeApplyFilter(tExprNode *pExpr, const void *pItem, SExprTraverseSupp
// handle the leaf node
param->setupInfoFn(pExpr, param->pExtInfo);
return param->nodeFilterFn(pItem, pExpr->_node.info);
#endif
return
0
;
}
// TODO: these three functions should be made global
...
...
@@ -141,59 +128,6 @@ static UNUSED_FUNC char* exception_strdup(const char* str) {
return
p
;
}
static
tExprNode
*
exprTreeFromBinaryImpl
(
SBufferReader
*
br
)
{
int32_t
anchor
=
CLEANUP_GET_ANCHOR
();
if
(
CLEANUP_EXCEED_LIMIT
())
{
THROW
(
TSDB_CODE_QRY_EXCEED_TAGS_LIMIT
);
return
NULL
;
}
tExprNode
*
pExpr
=
exception_calloc
(
1
,
sizeof
(
tExprNode
));
CLEANUP_PUSH_VOID_PTR_PTR
(
true
,
tExprTreeDestroy
,
pExpr
,
NULL
);
pExpr
->
nodeType
=
tbufReadUint8
(
br
);
if
(
pExpr
->
nodeType
==
TEXPR_VALUE_NODE
)
{
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
SVariant
));
pExpr
->
pVal
=
pVal
;
pVal
->
nType
=
tbufReadUint32
(
br
);
if
(
pVal
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
tbufReadToBuffer
(
br
,
&
pVal
->
nLen
,
sizeof
(
pVal
->
nLen
));
pVal
->
pz
=
taosMemoryCalloc
(
1
,
pVal
->
nLen
+
1
);
tbufReadToBuffer
(
br
,
pVal
->
pz
,
pVal
->
nLen
);
}
else
{
pVal
->
i
=
tbufReadInt64
(
br
);
}
}
else
if
(
pExpr
->
nodeType
==
TEXPR_COL_NODE
)
{
SSchema
*
pSchema
=
exception_calloc
(
1
,
sizeof
(
SSchema
));
pExpr
->
pSchema
=
pSchema
;
pSchema
->
colId
=
tbufReadInt16
(
br
);
pSchema
->
bytes
=
tbufReadInt16
(
br
);
pSchema
->
type
=
tbufReadUint8
(
br
);
tbufReadToString
(
br
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
);
}
else
if
(
pExpr
->
nodeType
==
TEXPR_BINARYEXPR_NODE
)
{
pExpr
->
_node
.
optr
=
tbufReadUint8
(
br
);
pExpr
->
_node
.
pLeft
=
exprTreeFromBinaryImpl
(
br
);
pExpr
->
_node
.
pRight
=
exprTreeFromBinaryImpl
(
br
);
assert
(
pExpr
->
_node
.
pLeft
!=
NULL
&&
pExpr
->
_node
.
pRight
!=
NULL
);
}
CLEANUP_EXECUTE_TO
(
anchor
,
false
);
return
pExpr
;
}
tExprNode
*
exprTreeFromBinary
(
const
void
*
data
,
size_t
size
)
{
if
(
size
==
0
)
{
return
NULL
;
}
SBufferReader
br
=
tbufInitReader
(
data
,
size
,
false
);
return
exprTreeFromBinaryImpl
(
&
br
);
}
void
buildFilterSetFromBinary
(
void
**
q
,
const
char
*
buf
,
int32_t
len
)
{
SBufferReader
br
=
tbufInitReader
(
buf
,
len
,
false
);
uint32_t
type
=
tbufReadUint32
(
&
br
);
...
...
@@ -405,38 +339,3 @@ err_ret:
taosHashCleanup
(
pObj
);
taosMemoryFreeClear
(
tmp
);
}
tExprNode
*
exprdup
(
tExprNode
*
pNode
)
{
if
(
pNode
==
NULL
)
{
return
NULL
;
}
tExprNode
*
pCloned
=
taosMemoryCalloc
(
1
,
sizeof
(
tExprNode
));
if
(
pNode
->
nodeType
==
TEXPR_BINARYEXPR_NODE
)
{
tExprNode
*
pLeft
=
exprdup
(
pNode
->
_node
.
pLeft
);
tExprNode
*
pRight
=
exprdup
(
pNode
->
_node
.
pRight
);
pCloned
->
_node
.
pLeft
=
pLeft
;
pCloned
->
_node
.
pRight
=
pRight
;
pCloned
->
_node
.
optr
=
pNode
->
_node
.
optr
;
}
else
if
(
pNode
->
nodeType
==
TEXPR_VALUE_NODE
)
{
pCloned
->
pVal
=
taosMemoryCalloc
(
1
,
sizeof
(
SVariant
));
taosVariantAssign
(
pCloned
->
pVal
,
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TEXPR_COL_NODE
)
{
pCloned
->
pSchema
=
taosMemoryCalloc
(
1
,
sizeof
(
SSchema
));
*
pCloned
->
pSchema
=
*
pNode
->
pSchema
;
}
else
if
(
pNode
->
nodeType
==
TEXPR_FUNCTION_NODE
)
{
strcpy
(
pCloned
->
_function
.
functionName
,
pNode
->
_function
.
functionName
);
int32_t
num
=
pNode
->
_function
.
num
;
pCloned
->
_function
.
num
=
num
;
pCloned
->
_function
.
pChild
=
taosMemoryCalloc
(
num
,
POINTER_BYTES
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
pCloned
->
_function
.
pChild
[
i
]
=
exprdup
(
pNode
->
_function
.
pChild
[
i
]);
}
}
pCloned
->
nodeType
=
pNode
->
nodeType
;
return
pCloned
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录