Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d3885d1
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看板
未验证
提交
3d3885d1
编写于
12月 21, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19070 from taosdata/enh/3.0_planner_optimize
enh: improve unit tests
上级
d2404f73
72fe3788
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1152 addition
and
40 deletion
+1152
-40
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+4
-4
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+1
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+1129
-17
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-4
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+3
-3
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+3
-3
source/libs/parser/src/parAuthenticator.c
source/libs/parser/src/parAuthenticator.c
+3
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+4
-4
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+1
-1
未找到文件。
include/libs/nodes/cmdnodes.h
浏览文件 @
3d3885d1
...
...
@@ -171,10 +171,10 @@ typedef struct SCreateSubTableClause {
STableOptions
*
pOptions
;
}
SCreateSubTableClause
;
typedef
struct
SCreateMultiTableStmt
{
typedef
struct
SCreateMultiTable
s
Stmt
{
ENodeType
type
;
SNodeList
*
pSubTables
;
}
SCreateMultiTableStmt
;
}
SCreateMultiTable
s
Stmt
;
typedef
struct
SDropTableClause
{
ENodeType
type
;
...
...
@@ -209,14 +209,14 @@ typedef struct SAlterTableStmt {
typedef
struct
SCreateUserStmt
{
ENodeType
type
;
char
useName
[
TSDB_USER_LEN
];
char
use
r
Name
[
TSDB_USER_LEN
];
char
password
[
TSDB_USET_PASSWORD_LEN
];
int8_t
sysinfo
;
}
SCreateUserStmt
;
typedef
struct
SAlterUserStmt
{
ENodeType
type
;
char
useName
[
TSDB_USER_LEN
];
char
use
r
Name
[
TSDB_USER_LEN
];
int8_t
alterType
;
char
password
[
TSDB_USET_PASSWORD_LEN
];
int8_t
enable
;
...
...
include/libs/nodes/nodes.h
浏览文件 @
3d3885d1
...
...
@@ -125,7 +125,7 @@ typedef enum ENodeType {
QUERY_NODE_TRIM_DATABASE_STMT
,
QUERY_NODE_CREATE_TABLE_STMT
,
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
,
QUERY_NODE_CREATE_MULTI_TABLE_STMT
,
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
,
QUERY_NODE_DROP_TABLE_CLAUSE
,
QUERY_NODE_DROP_TABLE_STMT
,
QUERY_NODE_DROP_SUPER_TABLE_STMT
,
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
3d3885d1
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
3d3885d1
...
...
@@ -321,8 +321,8 @@ SNode* nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
SCreateTableStmt
));
case
QUERY_NODE_CREATE_SUBTABLE_CLAUSE
:
return
makeNode
(
type
,
sizeof
(
SCreateSubTableClause
));
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateMultiTableStmt
));
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateMultiTable
s
Stmt
));
case
QUERY_NODE_DROP_TABLE_CLAUSE
:
return
makeNode
(
type
,
sizeof
(
SDropTableClause
));
case
QUERY_NODE_DROP_TABLE_STMT
:
...
...
@@ -861,8 +861,8 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode
((
SNode
*
)
pStmt
->
pOptions
);
break
;
}
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
nodesDestroyList
(((
SCreateMultiTableStmt
*
)
pNode
)
->
pSubTables
);
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
nodesDestroyList
(((
SCreateMultiTable
s
Stmt
*
)
pNode
)
->
pSubTables
);
break
;
case
QUERY_NODE_DROP_TABLE_CLAUSE
:
// no pointer field
break
;
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
3d3885d1
...
...
@@ -1208,7 +1208,7 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN
SNode
*
createCreateMultiTableStmt
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pSubTables
)
{
CHECK_PARSER_STATUS
(
pCxt
);
SCreateMultiTable
Stmt
*
pStmt
=
(
SCreateMultiTableStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_MULTI_TABLE
_STMT
);
SCreateMultiTable
sStmt
*
pStmt
=
(
SCreateMultiTablesStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_MULTI_TABLES
_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
pSubTables
=
pSubTables
;
return
(
SNode
*
)
pStmt
;
...
...
@@ -1430,7 +1430,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
}
SCreateUserStmt
*
pStmt
=
(
SCreateUserStmt
*
)
nodesMakeNode
(
QUERY_NODE_CREATE_USER_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
useName
,
pUserName
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
use
r
Name
,
pUserName
);
strcpy
(
pStmt
->
password
,
password
);
pStmt
->
sysinfo
=
sysinfo
;
return
(
SNode
*
)
pStmt
;
...
...
@@ -1443,7 +1443,7 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al
}
SAlterUserStmt
*
pStmt
=
(
SAlterUserStmt
*
)
nodesMakeNode
(
QUERY_NODE_ALTER_USER_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
useName
,
pUserName
);
COPY_STRING_FORM_ID_TOKEN
(
pStmt
->
use
r
Name
,
pUserName
);
pStmt
->
alterType
=
alterType
;
switch
(
alterType
)
{
case
TSDB_ALTER_USER_PASSWD
:
{
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
3d3885d1
...
...
@@ -252,7 +252,7 @@ static int32_t collectMetaKeyFromCreateTable(SCollectMetaKeyCxt* pCxt, SCreateTa
return
code
;
}
static
int32_t
collectMetaKeyFromCreateMultiTable
(
SCollectMetaKeyCxt
*
pCxt
,
SCreateMultiTableStmt
*
pStmt
)
{
static
int32_t
collectMetaKeyFromCreateMultiTable
(
SCollectMetaKeyCxt
*
pCxt
,
SCreateMultiTable
s
Stmt
*
pStmt
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pStmt
->
pSubTables
)
{
...
...
@@ -613,8 +613,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return
collectMetaKeyFromFlushDatabase
(
pCxt
,
(
SFlushDatabaseStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_TABLE_STMT
:
return
collectMetaKeyFromCreateTable
(
pCxt
,
(
SCreateTableStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
return
collectMetaKeyFromCreateMultiTable
(
pCxt
,
(
SCreateMultiTableStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
return
collectMetaKeyFromCreateMultiTable
(
pCxt
,
(
SCreateMultiTable
s
Stmt
*
)
pStmt
);
case
QUERY_NODE_DROP_TABLE_STMT
:
return
collectMetaKeyFromDropTable
(
pCxt
,
(
SDropTableStmt
*
)
pStmt
);
case
QUERY_NODE_ALTER_TABLE_STMT
:
...
...
source/libs/parser/src/parAuthenticator.c
浏览文件 @
3d3885d1
...
...
@@ -108,7 +108,7 @@ static int32_t authCreateTable(SAuthCxt* pCxt, SCreateTableStmt* pStmt) {
return
checkAuth
(
pCxt
,
pStmt
->
dbName
,
AUTH_TYPE_WRITE
);
}
static
int32_t
authCreateMultiTable
(
SAuthCxt
*
pCxt
,
SCreateMultiTableStmt
*
pStmt
)
{
static
int32_t
authCreateMultiTable
(
SAuthCxt
*
pCxt
,
SCreateMultiTable
s
Stmt
*
pStmt
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pStmt
->
pSubTables
)
{
...
...
@@ -134,8 +134,8 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return
authInsert
(
pCxt
,
(
SInsertStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_TABLE_STMT
:
return
authCreateTable
(
pCxt
,
(
SCreateTableStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
return
authCreateMultiTable
(
pCxt
,
(
SCreateMultiTableStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
return
authCreateMultiTable
(
pCxt
,
(
SCreateMultiTable
s
Stmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_DNODES_STMT
:
case
QUERY_NODE_SHOW_MNODES_STMT
:
case
QUERY_NODE_SHOW_MODULES_STMT
:
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
3d3885d1
...
...
@@ -5083,7 +5083,7 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p
static
int32_t
translateCreateUser
(
STranslateContext
*
pCxt
,
SCreateUserStmt
*
pStmt
)
{
SCreateUserReq
createReq
=
{
0
};
strcpy
(
createReq
.
user
,
pStmt
->
useName
);
strcpy
(
createReq
.
user
,
pStmt
->
use
r
Name
);
createReq
.
createType
=
0
;
createReq
.
superUser
=
0
;
createReq
.
sysInfo
=
pStmt
->
sysinfo
;
...
...
@@ -5095,7 +5095,7 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
static
int32_t
translateAlterUser
(
STranslateContext
*
pCxt
,
SAlterUserStmt
*
pStmt
)
{
SAlterUserReq
alterReq
=
{
0
};
strcpy
(
alterReq
.
user
,
pStmt
->
useName
);
strcpy
(
alterReq
.
user
,
pStmt
->
use
r
Name
);
alterReq
.
alterType
=
pStmt
->
alterType
;
alterReq
.
superUser
=
0
;
alterReq
.
enable
=
pStmt
->
enable
;
...
...
@@ -7029,7 +7029,7 @@ SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap) {
}
static
int32_t
rewriteCreateMultiTable
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
SCreateMultiTable
Stmt
*
pStmt
=
(
SCreateMultiTable
Stmt
*
)
pQuery
->
pRoot
;
SCreateMultiTable
sStmt
*
pStmt
=
(
SCreateMultiTables
Stmt
*
)
pQuery
->
pRoot
;
SHashObj
*
pVgroupHashmap
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
pVgroupHashmap
)
{
...
...
@@ -7637,7 +7637,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
code
=
rewriteCreateTable
(
pCxt
,
pQuery
);
}
break
;
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
code
=
rewriteCreateMultiTable
(
pCxt
,
pQuery
);
break
;
case
QUERY_NODE_DROP_TABLE_STMT
:
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
3d3885d1
...
...
@@ -1386,7 +1386,7 @@ static int32_t createSetOperatorLogicNode(SLogicPlanContext* pCxt, SSetOperator*
static
int32_t
getMsgType
(
ENodeType
sqlType
)
{
switch
(
sqlType
)
{
case
QUERY_NODE_CREATE_TABLE_STMT
:
case
QUERY_NODE_CREATE_MULTI_TABLE_STMT
:
case
QUERY_NODE_CREATE_MULTI_TABLE
S
_STMT
:
return
TDMT_VND_CREATE_TABLE
;
case
QUERY_NODE_DROP_TABLE_STMT
:
return
TDMT_VND_DROP_TABLE
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录