Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1342fbe9
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看板
提交
1342fbe9
编写于
7月 15, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: sql command 'show table distributed'
上级
873ff96b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
24 deletion
+23
-24
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+15
-23
source/libs/parser/test/parShowToUse.cpp
source/libs/parser/test/parShowToUse.cpp
+6
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+2
-1
未找到文件。
source/libs/parser/src/parAstParser.c
浏览文件 @
1342fbe9
...
...
@@ -118,36 +118,33 @@ static bool needGetTableIndex(SNode* pStmt) {
return
false
;
}
static
int32_t
collectMetaKeyFromRealTableImpl
(
SCollectMetaKeyCxt
*
pCxt
,
SRealTableNode
*
pReal
Table
,
static
int32_t
collectMetaKeyFromRealTableImpl
(
SCollectMetaKeyCxt
*
pCxt
,
const
char
*
pDb
,
const
char
*
p
Table
,
AUTH_TYPE
authType
)
{
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
pCxt
->
pMetaCache
);
int32_t
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
pDb
,
pTable
,
pCxt
->
pMetaCache
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
pCxt
->
pMetaCache
);
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pDb
,
pTable
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveUserAuthInCache
(
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
pUser
,
pRealTable
->
table
.
dbName
,
authType
,
pCxt
->
pMetaCache
);
code
=
reserveUserAuthInCache
(
pCxt
->
pParseCxt
->
acctId
,
pCxt
->
pParseCxt
->
pUser
,
pDb
,
authType
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
RealTable
->
table
.
dbName
,
pCxt
->
pMetaCache
);
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Db
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
needGetTableIndex
(
pCxt
->
pStmt
))
{
code
=
reserveTableIndexInCache
(
pCxt
->
pParseCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
pCxt
->
pMetaCache
);
code
=
reserveTableIndexInCache
(
pCxt
->
pParseCxt
->
acctId
,
pDb
,
pTable
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
p
RealTable
->
table
.
tableNam
e
,
TSDB_INS_TABLE_DNODE_VARIABLES
)))
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
p
Tabl
e
,
TSDB_INS_TABLE_DNODE_VARIABLES
)))
{
code
=
reserveDnodeRequiredInCache
(
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
RealTable
->
table
.
dbName
,
pCxt
->
pMetaCache
);
code
=
reserveDbCfgInCache
(
pCxt
->
pParseCxt
->
acctId
,
p
Db
,
pCxt
->
pMetaCache
);
}
return
code
;
}
static
EDealRes
collectMetaKeyFromRealTable
(
SCollectMetaKeyFromExprCxt
*
pCxt
,
SRealTableNode
*
pRealTable
)
{
pCxt
->
errCode
=
collectMetaKeyFromRealTableImpl
(
pCxt
->
pComCxt
,
pRealTable
,
AUTH_TYPE_READ
);
pCxt
->
errCode
=
collectMetaKeyFromRealTableImpl
(
pCxt
->
pComCxt
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
,
AUTH_TYPE_READ
);
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_CONTINUE
:
DEAL_RES_ERROR
;
}
...
...
@@ -454,11 +451,13 @@ static int32_t collectMetaKeyFromShowTransactions(SCollectMetaKeyCxt* pCxt, SSho
}
static
int32_t
collectMetaKeyFromDelete
(
SCollectMetaKeyCxt
*
pCxt
,
SDeleteStmt
*
pStmt
)
{
return
collectMetaKeyFromRealTableImpl
(
pCxt
,
(
SRealTableNode
*
)
pStmt
->
pFromTable
,
AUTH_TYPE_WRITE
);
STableNode
*
pTable
=
(
STableNode
*
)
pStmt
->
pFromTable
;
return
collectMetaKeyFromRealTableImpl
(
pCxt
,
pTable
->
dbName
,
pTable
->
tableName
,
AUTH_TYPE_WRITE
);
}
static
int32_t
collectMetaKeyFromInsert
(
SCollectMetaKeyCxt
*
pCxt
,
SInsertStmt
*
pStmt
)
{
int32_t
code
=
collectMetaKeyFromRealTableImpl
(
pCxt
,
(
SRealTableNode
*
)
pStmt
->
pTable
,
AUTH_TYPE_WRITE
);
STableNode
*
pTable
=
(
STableNode
*
)
pStmt
->
pTable
;
int32_t
code
=
collectMetaKeyFromRealTableImpl
(
pCxt
,
pTable
->
dbName
,
pTable
->
tableName
,
AUTH_TYPE_WRITE
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
collectMetaKeyFromQuery
(
pCxt
,
pStmt
->
pQuery
);
}
...
...
@@ -471,14 +470,7 @@ static int32_t collectMetaKeyFromShowBlockDist(SCollectMetaKeyCxt* pCxt, SShowTa
strcpy
(
name
.
tname
,
pStmt
->
tableName
);
int32_t
code
=
catalogRemoveTableMeta
(
pCxt
->
pParseCxt
->
pCatalog
,
&
name
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveTableVgroupInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
reserveDbVgInfoInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pCxt
->
pMetaCache
);
code
=
collectMetaKeyFromRealTableImpl
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
AUTH_TYPE_READ
);
}
return
code
;
}
...
...
source/libs/parser/test/parShowToUse.cpp
浏览文件 @
1342fbe9
...
...
@@ -179,6 +179,12 @@ TEST_F(ParserShowToUseTest, showTables) {
run
(
"SHOW test.tables like 'c%'"
);
}
TEST_F
(
ParserShowToUseTest
,
showTableDistributed
)
{
useDb
(
"root"
,
"test"
);
run
(
"SHOW TABLE DISTRIBUTED st1"
);
}
// todo SHOW topics
TEST_F
(
ParserShowToUseTest
,
showUsers
)
{
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
1342fbe9
...
...
@@ -198,7 +198,8 @@ static bool stbSplHasGatherExecFunc(const SNodeList* pFuncs) {
}
static
bool
stbSplIsMultiTbScan
(
bool
streamQuery
,
SScanLogicNode
*
pScan
)
{
return
(
NULL
!=
pScan
->
pVgroupList
&&
pScan
->
pVgroupList
->
numOfVgroups
>
1
);
return
(
NULL
!=
pScan
->
pVgroupList
&&
pScan
->
pVgroupList
->
numOfVgroups
>
1
)
||
(
streamQuery
&&
TSDB_SUPER_TABLE
==
pScan
->
tableType
);
}
static
bool
stbSplHasMultiTbScan
(
bool
streamQuery
,
SLogicNode
*
pNode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录