Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6951abce
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
6951abce
编写于
3月 24, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix
上级
4e0bdd14
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
19 deletion
+41
-19
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+28
-15
source/libs/planner/src/planScaleOut.c
source/libs/planner/src/planScaleOut.c
+1
-1
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+2
-0
source/libs/planner/test/plannerTest.cpp
source/libs/planner/test/plannerTest.cpp
+10
-3
未找到文件。
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
6951abce
...
@@ -120,23 +120,15 @@ public:
...
@@ -120,23 +120,15 @@ public:
}
}
int32_t
catalogGetTableHashVgroup
(
const
SName
*
pTableName
,
SVgroupInfo
*
vgInfo
)
const
{
int32_t
catalogGetTableHashVgroup
(
const
SName
*
pTableName
,
SVgroupInfo
*
vgInfo
)
const
{
// todo
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
vgInfo
->
vgId
=
1
;
tNameGetDbName
(
pTableName
,
db
);
addEpIntoEpSet
(
&
vgInfo
->
epSet
,
"node1"
,
6030
);
return
copyTableVgroup
(
db
,
tNameGetTableName
(
pTableName
),
vgInfo
);
return
0
;
}
}
int32_t
catalogGetTableDistVgInfo
(
const
SName
*
pTableName
,
SArray
**
pVgList
)
const
{
int32_t
catalogGetTableDistVgInfo
(
const
SName
*
pTableName
,
SArray
**
vgList
)
const
{
SVgroupInfo
info
=
{
0
};
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
info
.
vgId
=
1
;
tNameGetDbName
(
pTableName
,
db
);
addEpIntoEpSet
(
&
info
.
epSet
,
"node1"
,
6030
);
return
copyTableVgroup
(
db
,
tNameGetTableName
(
pTableName
),
vgList
);
info
.
hashBegin
=
0
;
info
.
hashEnd
=
1
;
*
pVgList
=
taosArrayInit
(
4
,
sizeof
(
SVgroupInfo
));
taosArrayPush
(
*
pVgList
,
&
info
);
return
0
;
}
}
TableBuilder
&
createTableBuilder
(
const
std
::
string
&
db
,
const
std
::
string
&
tbname
,
int8_t
tableType
,
int32_t
numOfColumns
,
int32_t
numOfTags
)
{
TableBuilder
&
createTableBuilder
(
const
std
::
string
&
db
,
const
std
::
string
&
tbname
,
int8_t
tableType
,
int32_t
numOfColumns
,
int32_t
numOfTags
)
{
...
@@ -293,6 +285,27 @@ private:
...
@@ -293,6 +285,27 @@ private:
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
copyTableVgroup
(
const
std
::
string
&
db
,
const
std
::
string
&
tbname
,
SVgroupInfo
*
vg
)
const
{
std
::
shared_ptr
<
MockTableMeta
>
table
=
getTableMeta
(
db
,
tbname
);
if
(
table
->
vgs
.
empty
())
{
return
TSDB_CODE_SUCCESS
;
}
memcpy
(
vg
,
&
(
table
->
vgs
[
0
]),
sizeof
(
SVgroupInfo
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
copyTableVgroup
(
const
std
::
string
&
db
,
const
std
::
string
&
tbname
,
SArray
**
vgList
)
const
{
std
::
shared_ptr
<
MockTableMeta
>
table
=
getTableMeta
(
db
,
tbname
);
if
(
table
->
vgs
.
empty
())
{
return
TSDB_CODE_SUCCESS
;
}
*
vgList
=
taosArrayInit
(
table
->
vgs
.
size
(),
sizeof
(
SVgroupInfo
));
for
(
const
SVgroupInfo
&
vg
:
table
->
vgs
)
{
taosArrayPush
(
*
vgList
,
&
vg
);
}
return
TSDB_CODE_SUCCESS
;
}
uint64_t
id_
;
uint64_t
id_
;
std
::
unique_ptr
<
TableBuilder
>
builder_
;
std
::
unique_ptr
<
TableBuilder
>
builder_
;
DbMetaCache
meta_
;
DbMetaCache
meta_
;
...
...
source/libs/planner/src/planScaleOut.c
浏览文件 @
6951abce
...
@@ -85,7 +85,7 @@ static int32_t setScanVgroup(SLogicNode* pNode, const SVgroupInfo* pVgroup) {
...
@@ -85,7 +85,7 @@ static int32_t setScanVgroup(SLogicNode* pNode, const SVgroupInfo* pVgroup) {
}
}
static
int32_t
scaleOutForScan
(
SScaleOutContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
int32_t
level
,
SNodeList
*
pGroup
)
{
static
int32_t
scaleOutForScan
(
SScaleOutContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
int32_t
level
,
SNodeList
*
pGroup
)
{
if
(
pSubplan
->
pVgroupList
)
{
if
(
pSubplan
->
pVgroupList
&&
!
pCxt
->
pPlanCxt
->
streamQuery
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
for
(
int32_t
i
=
0
;
i
<
pSubplan
->
pVgroupList
->
numOfVgroups
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pSubplan
->
pVgroupList
->
numOfVgroups
;
++
i
)
{
SLogicSubplan
*
pNewSubplan
=
singleCloneSubLogicPlan
(
pCxt
,
pSubplan
,
level
);
SLogicSubplan
*
pNewSubplan
=
singleCloneSubLogicPlan
(
pCxt
,
pSubplan
,
level
);
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
6951abce
...
@@ -106,6 +106,8 @@ static int32_t stsCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
...
@@ -106,6 +106,8 @@ static int32_t stsCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MERGE
;
if
(
NULL
==
pScan
->
node
.
pParent
)
{
if
(
NULL
==
pScan
->
node
.
pParent
)
{
pSubplan
->
pNode
=
(
SLogicNode
*
)
pExchange
;
pSubplan
->
pNode
=
(
SLogicNode
*
)
pExchange
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/planner/test/plannerTest.cpp
浏览文件 @
6951abce
...
@@ -41,7 +41,7 @@ protected:
...
@@ -41,7 +41,7 @@ protected:
cxt_
.
pSql
=
sqlBuf_
.
c_str
();
cxt_
.
pSql
=
sqlBuf_
.
c_str
();
}
}
bool
run
()
{
bool
run
(
bool
streamQuery
=
false
)
{
int32_t
code
=
qParseQuerySql
(
&
cxt_
,
&
query_
);
int32_t
code
=
qParseQuerySql
(
&
cxt_
,
&
query_
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -52,7 +52,7 @@ protected:
...
@@ -52,7 +52,7 @@ protected:
const
string
syntaxTreeStr
=
toString
(
query_
->
pRoot
,
false
);
const
string
syntaxTreeStr
=
toString
(
query_
->
pRoot
,
false
);
SLogicNode
*
pLogicNode
=
nullptr
;
SLogicNode
*
pLogicNode
=
nullptr
;
SPlanContext
cxt
=
{
.
queryId
=
1
,
.
acctId
=
0
};
SPlanContext
cxt
=
{
.
queryId
=
1
,
.
acctId
=
0
,
.
streamQuery
=
streamQuery
};
setPlanContext
(
query_
,
&
cxt
);
setPlanContext
(
query_
,
&
cxt
);
code
=
createLogicPlan
(
&
cxt
,
&
pLogicNode
);
code
=
createLogicPlan
(
&
cxt
,
&
pLogicNode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -61,7 +61,7 @@ protected:
...
@@ -61,7 +61,7 @@ protected:
}
}
cout
<<
"====================sql : ["
<<
cxt_
.
pSql
<<
"]"
<<
endl
;
cout
<<
"====================sql : ["
<<
cxt_
.
pSql
<<
"]"
<<
endl
;
cout
<<
"syntax t
est
: "
<<
endl
;
cout
<<
"syntax t
ree
: "
<<
endl
;
cout
<<
syntaxTreeStr
<<
endl
;
cout
<<
syntaxTreeStr
<<
endl
;
cout
<<
"unformatted logic plan : "
<<
endl
;
cout
<<
"unformatted logic plan : "
<<
endl
;
cout
<<
toString
((
const
SNode
*
)
pLogicNode
,
false
)
<<
endl
;
cout
<<
toString
((
const
SNode
*
)
pLogicNode
,
false
)
<<
endl
;
...
@@ -204,3 +204,10 @@ TEST_F(PlannerTest, createTopic) {
...
@@ -204,3 +204,10 @@ TEST_F(PlannerTest, createTopic) {
bind
(
"create topic tp as SELECT * FROM st1"
);
bind
(
"create topic tp as SELECT * FROM st1"
);
ASSERT_TRUE
(
run
());
ASSERT_TRUE
(
run
());
}
}
TEST_F
(
PlannerTest
,
stream
)
{
setDatabase
(
"root"
,
"test"
);
bind
(
"SELECT sum(c1) FROM st1"
);
ASSERT_TRUE
(
run
(
true
));
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录