Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aebe84bd
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看板
未验证
提交
aebe84bd
编写于
9月 09, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16749 from taosdata/enh/3.0_planner_optimize
enh: add binary serialization method to node structure
上级
2c83fee4
d66bb918
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
3149 addition
and
20 deletion
+3149
-20
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+3
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+0
-20
source/libs/nodes/src/nodesMsgFuncs.c
source/libs/nodes/src/nodesMsgFuncs.c
+3108
-0
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+38
-0
未找到文件。
include/libs/nodes/nodes.h
浏览文件 @
aebe84bd
...
...
@@ -320,6 +320,9 @@ int32_t nodesStringToNode(const char* pStr, SNode** pNode);
int32_t
nodesListToString
(
const
SNodeList
*
pList
,
bool
format
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
nodesStringToList
(
const
char
*
pStr
,
SNodeList
**
pList
);
int32_t
nodesNodeToMsg
(
const
SNode
*
pNode
,
char
**
pMsg
,
int32_t
*
pLen
);
int32_t
nodesMsgToNode
(
const
char
*
pStr
,
int32_t
len
,
SNode
**
pNode
);
int32_t
nodesNodeToSQL
(
SNode
*
pNode
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
len
);
char
*
nodesGetNameFromColumnNode
(
SNode
*
pNode
);
int32_t
nodesGetOutputNumFromSlotList
(
SNodeList
*
pSlots
);
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
aebe84bd
...
...
@@ -362,18 +362,14 @@ static int32_t jsonToTableComInfo(const SJson* pJson, void* pObj) {
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfTags
,
pNode
->
numOfTags
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoPrecision
,
pNode
->
precision
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfColumns
,
pNode
->
numOfColumns
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoRowSize
,
pNode
->
rowSize
,
code
);
;
}
return
code
;
...
...
@@ -406,14 +402,11 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) {
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkSchemaType
,
pNode
->
type
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSchemaColId
,
pNode
->
colId
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSchemaBytes
,
pNode
->
bytes
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkSchemaName
,
pNode
->
name
);
...
...
@@ -466,26 +459,20 @@ static int32_t jsonToTableMeta(const SJson* pJson, void* pObj) {
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkTableMetaVgId
,
pNode
->
vgId
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaTableType
,
pNode
->
tableType
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaUid
,
pNode
->
uid
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaSuid
,
pNode
->
suid
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaSversion
,
pNode
->
sversion
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaTversion
,
pNode
->
tversion
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonToObject
(
pJson
,
jkTableMetaComInfo
,
jsonToTableComInfo
,
&
pNode
->
tableInfo
);
...
...
@@ -926,7 +913,6 @@ static int32_t jsonToLogicFillNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToLogicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkFillLogicPlanMode
,
pNode
->
mode
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillLogicPlanWStartTs
,
&
pNode
->
pWStartTs
);
...
...
@@ -2815,7 +2801,6 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkColumnColType
,
pNode
->
colType
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkColumnDbName
,
pNode
->
dbName
);
...
...
@@ -3118,7 +3103,6 @@ static int32_t jsonToOperatorNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOperatorType
,
pNode
->
opType
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkOperatorLeft
,
&
pNode
->
pLeft
);
...
...
@@ -3153,7 +3137,6 @@ static int32_t jsonToLogicConditionNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkLogicCondType
,
pNode
->
condType
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkLogicCondParameters
,
&
pNode
->
pParameterList
);
...
...
@@ -3442,11 +3425,9 @@ static int32_t jsonToOrderByExprNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToNodeObject
(
pJson
,
jkOrderByExprExpr
,
&
pNode
->
pExpr
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOrderByExprOrder
,
pNode
->
order
,
code
);
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOrderByExprNullOrder
,
pNode
->
nullOrder
,
code
);
;
}
return
code
;
...
...
@@ -3624,7 +3605,6 @@ static int32_t jsonToFillNode(const SJson* pJson, void* pObj) {
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkFillMode
,
pNode
->
mode
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillValues
,
&
pNode
->
pValues
);
}
...
...
source/libs/nodes/src/nodesMsgFuncs.c
0 → 100644
浏览文件 @
aebe84bd
此差异已折叠。
点击以展开。
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
aebe84bd
...
...
@@ -19,6 +19,7 @@
#include <algorithm>
#include <array>
#include <chrono>
#include "cmdnodes.h"
#include "mockCatalogService.h"
...
...
@@ -251,6 +252,7 @@ class PlannerTestBaseImpl {
string
splitLogicPlan_
;
string
scaledLogicPlan_
;
string
physiPlan_
;
string
physiPlanMsg_
;
vector
<
string
>
physiSubplans_
;
};
...
...
@@ -274,6 +276,7 @@ class PlannerTestBaseImpl {
res_
.
splitLogicPlan_
.
clear
();
res_
.
scaledLogicPlan_
.
clear
();
res_
.
physiPlan_
.
clear
();
res_
.
physiPlanMsg_
.
clear
();
res_
.
physiSubplans_
.
clear
();
}
...
...
@@ -408,6 +411,8 @@ class PlannerTestBaseImpl {
SNode
*
pSubplan
;
FOREACH
(
pSubplan
,
((
SNodeListNode
*
)
pNode
)
->
pNodeList
)
{
res_
.
physiSubplans_
.
push_back
(
toString
(
pSubplan
));
}
}
res_
.
physiPlanMsg_
=
toMsg
((
SNode
*
)(
*
pPlan
));
cout
<<
"json len: "
<<
res_
.
physiPlan_
.
length
()
<<
", msg len: "
<<
res_
.
physiPlanMsg_
.
length
()
<<
endl
;
}
void
setPlanContext
(
SQuery
*
pQuery
,
SPlanContext
*
pCxt
)
{
...
...
@@ -446,12 +451,45 @@ class PlannerTestBaseImpl {
string
toString
(
const
SNode
*
pRoot
)
{
char
*
pStr
=
NULL
;
int32_t
len
=
0
;
auto
start
=
chrono
::
steady_clock
::
now
();
DO_WITH_THROW
(
nodesNodeToString
,
pRoot
,
false
,
&
pStr
,
&
len
)
if
(
QUERY_NODE_PHYSICAL_PLAN
==
nodeType
(
pRoot
))
{
cout
<<
"nodesNodeToString: "
<<
chrono
::
duration_cast
<
chrono
::
microseconds
>
(
chrono
::
steady_clock
::
now
()
-
start
).
count
()
<<
"us"
<<
endl
;
}
string
str
(
pStr
);
taosMemoryFreeClear
(
pStr
);
return
str
;
}
string
toMsg
(
const
SNode
*
pRoot
)
{
char
*
pStr
=
NULL
;
int32_t
len
=
0
;
auto
start
=
chrono
::
steady_clock
::
now
();
DO_WITH_THROW
(
nodesNodeToMsg
,
pRoot
,
&
pStr
,
&
len
)
cout
<<
"nodesNodeToMsg: "
<<
chrono
::
duration_cast
<
chrono
::
microseconds
>
(
chrono
::
steady_clock
::
now
()
-
start
).
count
()
<<
"us"
<<
endl
;
SNode
*
pNode
=
NULL
;
char
*
pNewStr
=
NULL
;
int32_t
newlen
=
0
;
DO_WITH_THROW
(
nodesMsgToNode
,
pStr
,
len
,
&
pNode
)
DO_WITH_THROW
(
nodesNodeToMsg
,
pNode
,
&
pNewStr
,
&
newlen
)
if
(
newlen
!=
len
||
0
!=
memcmp
(
pStr
,
pNewStr
,
len
))
{
cout
<<
"nodesNodeToMsg error!!!!!!!!!!!!!! len = "
<<
len
<<
", newlen = "
<<
newlen
<<
endl
;
DO_WITH_THROW
(
nodesNodeToString
,
pNode
,
false
,
&
pNewStr
,
&
newlen
)
cout
<<
"nodesNodeToString "
<<
pNewStr
<<
endl
;
}
taosMemoryFreeClear
(
pNewStr
);
string
str
(
pStr
,
len
);
taosMemoryFreeClear
(
pStr
);
return
str
;
}
caseEnv
caseEnv_
;
stmtEnv
stmtEnv_
;
stmtRes
res_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录