Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7128b3cd
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7128b3cd
编写于
1月 04, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] refactor.
上级
09fe692b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
19 addition
and
18 deletion
+19
-18
include/libs/parser/parsenodes.h
include/libs/parser/parsenodes.h
+2
-2
source/libs/parser/inc/insertParser.h
source/libs/parser/inc/insertParser.h
+1
-1
source/libs/parser/inc/parserInt.h
source/libs/parser/inc/parserInt.h
+1
-1
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+7
-6
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+3
-3
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+2
-2
source/libs/parser/test/insertParserTest.cpp
source/libs/parser/test/insertParserTest.cpp
+2
-2
source/libs/planner/src/logicPlan.c
source/libs/planner/src/logicPlan.c
+1
-1
未找到文件。
include/libs/parser/parsenodes.h
浏览文件 @
7128b3cd
...
...
@@ -154,14 +154,14 @@ typedef struct SVgDataBlocks {
char
*
pData
;
// SMsgDesc + SSubmitMsg + SSubmitBlk + ...
}
SVgDataBlocks
;
typedef
struct
S
Insert
StmtInfo
{
typedef
struct
S
VnodeModifOp
StmtInfo
{
int16_t
nodeType
;
SArray
*
pDataBlocks
;
// data block for each vgroup, SArray<SVgDataBlocks*>.
int8_t
schemaAttache
;
// denote if submit block is built with table schema or not
uint8_t
payloadType
;
// EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
uint32_t
insertType
;
// insert data from [file|sql statement| bound statement]
const
char
*
sql
;
// current sql statement position
}
S
Insert
StmtInfo
;
}
S
VnodeModifOp
StmtInfo
;
typedef
struct
SDclStmtInfo
{
int16_t
nodeType
;
...
...
source/libs/parser/inc/insertParser.h
浏览文件 @
7128b3cd
...
...
@@ -22,7 +22,7 @@ extern "C" {
#include "parser.h"
int32_t
parseInsertSql
(
SParseContext
*
pContext
,
S
Insert
StmtInfo
**
pInfo
);
int32_t
parseInsertSql
(
SParseContext
*
pContext
,
S
VnodeModifOp
StmtInfo
**
pInfo
);
#ifdef __cplusplus
}
...
...
source/libs/parser/inc/parserInt.h
浏览文件 @
7128b3cd
...
...
@@ -70,7 +70,7 @@ int32_t qParserValidateSqlNode(struct SCatalog* pCatalog, SSqlInfo* pSqlInfo, SQ
*/
SDclStmtInfo
*
qParserValidateDclSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
char
*
msgBuf
,
int32_t
msgBufLen
);
S
Insert
StmtInfo
*
qParserValidateCreateTbSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
char
*
msgBuf
,
int32_t
msgBufLen
);
S
VnodeModifOp
StmtInfo
*
qParserValidateCreateTbSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
char
*
msgBuf
,
int32_t
msgBufLen
);
/**
* Evaluate the numeric and timestamp arithmetic expression in the WHERE clause.
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
7128b3cd
...
...
@@ -548,11 +548,12 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
taosArrayPush
(
pBufArray
,
&
pVgData
);
}
while
(
true
);
S
InsertStmtInfo
*
pStmtInfo
=
calloc
(
1
,
sizeof
(
SInsert
StmtInfo
));
pStmtInfo
->
nodeType
=
TSDB_SQL_CREATE_TABLE
;
S
VnodeModifOpStmtInfo
*
pStmtInfo
=
calloc
(
1
,
sizeof
(
SVnodeModifOp
StmtInfo
));
pStmtInfo
->
nodeType
=
TSDB_SQL_CREATE_TABLE
;
pStmtInfo
->
pDataBlocks
=
pBufArray
;
*
pOutput
=
pStmtInfo
;
*
len
=
sizeof
(
SInsertStmtInfo
);
*
pOutput
=
(
char
*
)
pStmtInfo
;
*
len
=
sizeof
(
SVnodeModifOpStmtInfo
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -823,14 +824,14 @@ SDclStmtInfo* qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, c
return
NULL
;
}
S
Insert
StmtInfo
*
qParserValidateCreateTbSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
S
VnodeModifOp
StmtInfo
*
qParserValidateCreateTbSqlNode
(
SSqlInfo
*
pInfo
,
SParseBasicCtx
*
pCtx
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
SCreateTableSql
*
pCreateTable
=
pInfo
->
pCreateTableInfo
;
assert
(
pCreateTable
->
type
==
TSQL_CREATE_CTABLE
);
SMsgBuf
m
=
{.
buf
=
msgBuf
,
.
len
=
msgBufLen
};
SMsgBuf
*
pMsgBuf
=
&
m
;
S
Insert
StmtInfo
*
pInsertStmt
=
NULL
;
S
VnodeModifOp
StmtInfo
*
pInsertStmt
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
code
=
doCheckForCreateCTable
(
pInfo
,
pCtx
,
pMsgBuf
,
(
char
**
)
&
pInsertStmt
,
&
msgLen
);
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
7128b3cd
...
...
@@ -61,7 +61,7 @@ typedef struct SInsertParseContext {
SArray
*
pTableDataBlocks
;
// global
SArray
*
pVgDataBlocks
;
// global
int32_t
totalNum
;
S
Insert
StmtInfo
*
pOutput
;
S
VnodeModifOp
StmtInfo
*
pOutput
;
}
SInsertParseContext
;
static
int32_t
skipInsertInto
(
SInsertParseContext
*
pCxt
)
{
...
...
@@ -611,7 +611,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
// [(field1_name, ...)]
// VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
// [...];
int32_t
parseInsertSql
(
SParseContext
*
pContext
,
S
Insert
StmtInfo
**
pInfo
)
{
int32_t
parseInsertSql
(
SParseContext
*
pContext
,
S
VnodeModifOp
StmtInfo
**
pInfo
)
{
SInsertParseContext
context
=
{
.
pComCxt
=
pContext
,
.
pSql
=
(
char
*
)
pContext
->
pSql
,
...
...
@@ -620,7 +620,7 @@ int32_t parseInsertSql(SParseContext* pContext, SInsertStmtInfo** pInfo) {
.
pVgroupsHashObj
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
false
),
.
pTableBlockHashObj
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
),
.
totalNum
=
0
,
.
pOutput
=
calloc
(
1
,
sizeof
(
S
Insert
StmtInfo
))
.
pOutput
=
calloc
(
1
,
sizeof
(
S
VnodeModifOp
StmtInfo
))
};
if
(
NULL
==
context
.
pVgroupsHashObj
||
NULL
==
context
.
pTableBlockHashObj
||
NULL
==
context
.
pOutput
)
{
...
...
source/libs/parser/src/parser.c
浏览文件 @
7128b3cd
...
...
@@ -53,7 +53,7 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
}
if
(
toVnode
)
{
S
Insert
StmtInfo
*
pInsertInfo
=
qParserValidateCreateTbSqlNode
(
&
info
,
&
pCxt
->
ctx
,
pCxt
->
pMsg
,
pCxt
->
msgLen
);
S
VnodeModifOp
StmtInfo
*
pInsertInfo
=
qParserValidateCreateTbSqlNode
(
&
info
,
&
pCxt
->
ctx
,
pCxt
->
pMsg
,
pCxt
->
msgLen
);
if
(
pInsertInfo
==
NULL
)
{
return
terrno
;
}
...
...
@@ -87,7 +87,7 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQueryNode
**
pQuery
)
{
if
(
isInsertSql
(
pCxt
->
pSql
,
pCxt
->
sqlLen
))
{
return
parseInsertSql
(
pCxt
,
(
S
Insert
StmtInfo
**
)
pQuery
);
return
parseInsertSql
(
pCxt
,
(
S
VnodeModifOp
StmtInfo
**
)
pQuery
);
}
else
{
return
parseQuerySql
(
pCxt
,
pQuery
);
}
...
...
source/libs/parser/test/insertParserTest.cpp
浏览文件 @
7128b3cd
...
...
@@ -60,7 +60,7 @@ protected:
return
code_
;
}
S
Insert
StmtInfo
*
reslut
()
{
S
VnodeModifOp
StmtInfo
*
reslut
()
{
return
res_
;
}
...
...
@@ -128,7 +128,7 @@ private:
char
sqlBuf_
[
max_sql_len
];
SParseContext
cxt_
;
int32_t
code_
;
S
Insert
StmtInfo
*
res_
;
S
VnodeModifOp
StmtInfo
*
res_
;
};
// INSERT INTO tb_name VALUES (field1_value, ...)
...
...
source/libs/planner/src/logicPlan.c
浏览文件 @
7128b3cd
...
...
@@ -38,7 +38,7 @@ int32_t optimizeQueryPlan(struct SQueryPlanNode* pQueryNode) {
}
static
int32_t
createModificationOpPlan
(
const
SQueryNode
*
pNode
,
SQueryPlanNode
**
pQueryPlan
)
{
S
InsertStmtInfo
*
pInsert
=
(
SInsert
StmtInfo
*
)
pNode
;
S
VnodeModifOpStmtInfo
*
pInsert
=
(
SVnodeModifOp
StmtInfo
*
)
pNode
;
*
pQueryPlan
=
calloc
(
1
,
sizeof
(
SQueryPlanNode
));
SArray
*
blocks
=
taosArrayInit
(
taosArrayGetSize
(
pInsert
->
pDataBlocks
),
POINTER_BYTES
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录