Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b686e1fd
TDengine
项目概览
taosdata
/
TDengine
接近 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b686e1fd
编写于
12月 28, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: delete useless code
上级
01b90f45
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
922 deletion
+14
-922
source/libs/parser/inc/parInsertUtil.h
source/libs/parser/inc/parInsertUtil.h
+8
-109
source/libs/parser/src/parInsertSml.c
source/libs/parser/src/parInsertSml.c
+1
-1
source/libs/parser/src/parInsertSql.c
source/libs/parser/src/parInsertSql.c
+3
-3
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+2
-809
未找到文件。
source/libs/parser/inc/parInsertUtil.h
浏览文件 @
b686e1fd
...
@@ -35,128 +35,27 @@ struct SToken;
...
@@ -35,128 +35,27 @@ struct SToken;
} \
} \
} while (0)
} while (0)
#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED)
typedef
enum
EOrderStatus
{
ORDER_STATUS_UNKNOWN
=
0
,
ORDER_STATUS_ORDERED
=
1
,
ORDER_STATUS_DISORDERED
=
2
,
}
EOrderStatus
;
typedef
enum
EValStat
{
VAL_STAT_HAS
=
0x0
,
// 0 means has val
VAL_STAT_NONE
=
0x01
,
// 1 means no val
}
EValStat
;
typedef
struct
SBoundColumn
{
int32_t
offset
;
// all column offset value
int32_t
toffset
;
// first part offset for SDataRow TODO: get offset from STSchema on future
uint8_t
valStat
;
// EValStat. denote if current column bound or not(0 means has val, 1 means no val)
}
SBoundColumn
;
typedef
struct
{
col_id_t
schemaColIdx
;
col_id_t
boundIdx
;
col_id_t
finalIdx
;
}
SBoundIdxInfo
;
typedef
struct
SParsedDataColInfo
{
col_id_t
numOfCols
;
col_id_t
numOfBound
;
uint16_t
flen
;
// TODO: get from STSchema
uint16_t
allNullLen
;
// TODO: get from STSchema(base on SDataRow)
uint16_t
extendedVarLen
;
uint16_t
boundNullLen
;
// bound column len with all NULL value(without VarDataOffsetT/SColIdx part)
col_id_t
*
boundColumns
;
// bound column idx according to schema
SBoundColumn
*
cols
;
SBoundIdxInfo
*
colIdxInfo
;
int8_t
orderStatus
;
// bound columns
}
SParsedDataColInfo
;
typedef
struct
SInsertParseBaseContext
{
SParseContext
*
pComCxt
;
char
*
pSql
;
SMsgBuf
msg
;
}
SInsertParseBaseContext
;
typedef
struct
SInsertParseSyntaxCxt
{
SParseContext
*
pComCxt
;
char
*
pSql
;
SMsgBuf
msg
;
SParseMetaCache
*
pMetaCache
;
}
SInsertParseSyntaxCxt
;
typedef
struct
SMemParam
{
SRowBuilder
*
rb
;
SSchema
*
schema
;
int32_t
toffset
;
col_id_t
colIdx
;
}
SMemParam
;
typedef
struct
{
uint8_t
rowType
;
// default is 0, that is SDataRow
int32_t
rowSize
;
}
SMemRowBuilder
;
typedef
struct
STableDataBlocks
{
int8_t
tsSource
;
// where does the UNIX timestamp come from, server or client
bool
ordered
;
// if current rows are ordered or not
int32_t
vgId
;
// virtual group id
int64_t
prevTS
;
// previous timestamp, recorded to decide if the records array is ts ascending
int32_t
numOfTables
;
// number of tables in current submit block
int32_t
rowSize
;
// row size for current table
uint32_t
nAllocSize
;
uint32_t
headerSize
;
// header for table info (uid, tid, submit metadata)
uint32_t
size
;
STableMeta
*
pTableMeta
;
// the tableMeta of current table, the table meta will be used during submit, keep a ref to
// avoid to be removed from cache
char
*
pData
;
bool
cloned
;
int32_t
createTbReqLen
;
SParsedDataColInfo
boundColumnInfo
;
SRowBuilder
rowBuilder
;
}
STableDataBlocks
;
int32_t
insGetExtendedRowSize
(
STableDataBlocks
*
pBlock
);
void
insGetSTSRowAppendInfo
(
uint8_t
rowType
,
SParsedDataColInfo
*
spd
,
col_id_t
idx
,
int32_t
*
toffset
,
col_id_t
*
colIdx
);
int32_t
insSetBlockInfo
(
SSubmitBlk
*
pBlocks
,
STableDataBlocks
*
dataBuf
,
int32_t
numOfRows
,
SMsgBuf
*
pMsg
);
int32_t
insSchemaIdxCompar
(
const
void
*
lhs
,
const
void
*
rhs
);
int32_t
insBoundIdxCompar
(
const
void
*
lhs
,
const
void
*
rhs
);
void
insSetBoundColumnInfo
(
SParsedDataColInfo
*
pColList
,
SSchema
*
pSchema
,
col_id_t
numOfCols
);
void
insDestroyBlockArrayList
(
SArray
*
pDataBlockList
);
void
insDestroyBlockHashmap
(
SHashObj
*
pDataBlockHash
);
int32_t
insInitRowBuilder
(
SRowBuilder
*
pBuilder
,
int16_t
schemaVer
,
SParsedDataColInfo
*
pColInfo
);
int32_t
insGetDataBlockFromList
(
SHashObj
*
pHashList
,
void
*
id
,
int32_t
idLen
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
,
SArray
*
pBlockList
,
SVCreateTbReq
*
pCreateTbReq
);
int32_t
insMergeTableDataBlocks
(
SHashObj
*
pHashObj
,
SArray
**
pVgDataBlocks
);
int32_t
insBuildCreateTbMsg
(
STableDataBlocks
*
pBlocks
,
SVCreateTbReq
*
pCreateTbReq
);
int32_t
insAllocateMemForSize
(
STableDataBlocks
*
pDataBlock
,
int32_t
allSize
);
int32_t
insCreateSName
(
SName
*
pName
,
struct
SToken
*
pTableName
,
int32_t
acctId
,
const
char
*
dbName
,
SMsgBuf
*
pMsgBuf
);
int16_t
insFindCol
(
struct
SToken
*
pColname
,
int16_t
start
,
int16_t
end
,
SSchema
*
pSchema
);
void
insBuildCreateTbReq
(
SVCreateTbReq
*
pTbReq
,
const
char
*
tname
,
STag
*
pTag
,
int64_t
suid
,
const
char
*
sname
,
SArray
*
tagName
,
uint8_t
tagNum
,
int32_t
ttl
);
int32_t
insMemRowAppend
(
SMsgBuf
*
pMsgBuf
,
const
void
*
value
,
int32_t
len
,
void
*
param
);
int32_t
insCheckTimestamp
(
STableDataBlocks
*
pDataBlocks
,
const
char
*
start
);
int32_t
insBuildOutput
(
SHashObj
*
pVgroupsHashObj
,
SArray
*
pVgDataBlocks
,
SArray
**
pDataBlocks
);
void
insDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
);
typedef
struct
SVgroupDataCxt
{
typedef
struct
SVgroupDataCxt
{
int32_t
vgId
;
int32_t
vgId
;
SSubmitReq2
*
pData
;
SSubmitReq2
*
pData
;
}
SVgroupDataCxt
;
}
SVgroupDataCxt
;
int32_t
insCreateSName
(
SName
*
pName
,
struct
SToken
*
pTableName
,
int32_t
acctId
,
const
char
*
dbName
,
SMsgBuf
*
pMsgBuf
);
int16_t
insFindCol
(
struct
SToken
*
pColname
,
int16_t
start
,
int16_t
end
,
SSchema
*
pSchema
);
void
insBuildCreateTbReq
(
SVCreateTbReq
*
pTbReq
,
const
char
*
tname
,
STag
*
pTag
,
int64_t
suid
,
const
char
*
sname
,
SArray
*
tagName
,
uint8_t
tagNum
,
int32_t
ttl
);
int32_t
insInitBoundColsInfo
(
int32_t
numOfBound
,
SBoundColInfo
*
pInfo
);
int32_t
insInitBoundColsInfo
(
int32_t
numOfBound
,
SBoundColInfo
*
pInfo
);
void
insCheckTableDataOrder
(
STableDataCxt
*
pTableCxt
,
TSKEY
tsKey
);
void
insCheckTableDataOrder
(
STableDataCxt
*
pTableCxt
,
TSKEY
tsKey
);
int32_t
insGetTableDataCxt
(
SHashObj
*
pHash
,
void
*
id
,
int32_t
idLen
,
STableMeta
*
pTableMeta
,
int32_t
insGetTableDataCxt
(
SHashObj
*
pHash
,
void
*
id
,
int32_t
idLen
,
STableMeta
*
pTableMeta
,
SVCreateTbReq
**
pCreateTbReq
,
STableDataCxt
**
pTableCxt
,
bool
colMode
);
SVCreateTbReq
**
pCreateTbReq
,
STableDataCxt
**
pTableCxt
,
bool
colMode
);
int32_t
initTableColSubmitData
(
STableDataCxt
*
pTableCxt
);
int32_t
initTableColSubmitData
(
STableDataCxt
*
pTableCxt
);
int32_t
insMergeTableDataCxt
(
SHashObj
*
pTableHash
,
SArray
**
pVgDataBlocks
);
int32_t
insMergeTableDataCxt
(
SHashObj
*
pTableHash
,
SArray
**
pVgDataBlocks
);
int32_t
insBuildVgDataBlocks
(
SHashObj
*
pVgroupsHashObj
,
SArray
*
pVgDataBlocks
,
SArray
**
pDataBlocks
);
int32_t
insBuildVgDataBlocks
(
SHashObj
*
pVgroupsHashObj
,
SArray
*
pVgDataBlocks
,
SArray
**
pDataBlocks
);
void
insDestroyTableDataCxtHashMap
(
SHashObj
*
pTableCxtHash
);
void
insDestroyTableDataCxtHashMap
(
SHashObj
*
pTableCxtHash
);
void
insDestroyVgroupDataCxt
(
SVgroupDataCxt
*
pVgCxt
);
void
insDestroyVgroupDataCxt
(
SVgroupDataCxt
*
pVgCxt
);
void
insDestroyVgroupDataCxtList
(
SArray
*
pVgCxtList
);
void
insDestroyVgroupDataCxtList
(
SArray
*
pVgCxtList
);
void
insDestroyVgroupDataCxtHashMap
(
SHashObj
*
pVgCxtHash
);
void
insDestroyVgroupDataCxtHashMap
(
SHashObj
*
pVgCxtHash
);
void
insDestroyTableDataCxt
(
STableDataCxt
*
pTableCxt
);
void
insDestroyTableDataCxt
(
STableDataCxt
*
pTableCxt
);
void
destroyBoundColInfo
(
SBoundColInfo
*
pInfo
);
void
insDestroyBoundColInfo
(
SBoundColInfo
*
pInfo
);
#endif // TDENGINE_PAR_INSERT_UTIL_H
#endif // TDENGINE_PAR_INSERT_UTIL_H
source/libs/parser/src/parInsertSml.c
浏览文件 @
b686e1fd
...
@@ -348,7 +348,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
...
@@ -348,7 +348,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
}
}
end:
end:
d
estroyBoundColInfo
(
&
bindTags
);
insD
estroyBoundColInfo
(
&
bindTags
);
taosMemoryFree
(
pCreateTblReq
);
taosMemoryFree
(
pCreateTblReq
);
taosArrayDestroy
(
tagName
);
taosArrayDestroy
(
tagName
);
return
ret
;
return
ret
;
...
...
source/libs/parser/src/parInsertSql.c
浏览文件 @
b686e1fd
...
@@ -1466,7 +1466,7 @@ static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeMod
...
@@ -1466,7 +1466,7 @@ static int32_t parseInsertTableClauseBottom(SInsertParseContext* pCxt, SVnodeMod
}
}
static
void
resetEnvPreTable
(
SInsertParseContext
*
pCxt
,
SVnodeModifyOpStmt
*
pStmt
)
{
static
void
resetEnvPreTable
(
SInsertParseContext
*
pCxt
,
SVnodeModifyOpStmt
*
pStmt
)
{
d
estroyBoundColInfo
(
&
pCxt
->
tags
);
insD
estroyBoundColInfo
(
&
pCxt
->
tags
);
taosMemoryFreeClear
(
pStmt
->
pTableMeta
);
taosMemoryFreeClear
(
pStmt
->
pTableMeta
);
tdDestroySVCreateTbReq
(
pStmt
->
pCreateTblReq
);
tdDestroySVCreateTbReq
(
pStmt
->
pCreateTblReq
);
taosMemoryFreeClear
(
pStmt
->
pCreateTblReq
);
taosMemoryFreeClear
(
pStmt
->
pCreateTblReq
);
...
@@ -1527,7 +1527,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif
...
@@ -1527,7 +1527,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif
}
}
static
int32_t
setStmtInfo
(
SInsertParseContext
*
pCxt
,
SVnodeModifyOpStmt
*
pStmt
)
{
static
int32_t
setStmtInfo
(
SInsertParseContext
*
pCxt
,
SVnodeModifyOpStmt
*
pStmt
)
{
S
ParsedData
ColInfo
*
tags
=
taosMemoryMalloc
(
sizeof
(
pCxt
->
tags
));
S
Bound
ColInfo
*
tags
=
taosMemoryMalloc
(
sizeof
(
pCxt
->
tags
));
if
(
NULL
==
tags
)
{
if
(
NULL
==
tags
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -1937,6 +1937,6 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal
...
@@ -1937,6 +1937,6 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal
QUERY_EXEC_STAGE_SCHEDULE
==
(
*
pQuery
)
->
execStage
)
{
QUERY_EXEC_STAGE_SCHEDULE
==
(
*
pQuery
)
->
execStage
)
{
code
=
setRefreshMate
(
*
pQuery
);
code
=
setRefreshMate
(
*
pQuery
);
}
}
d
estroyBoundColInfo
(
&
context
.
tags
);
insD
estroyBoundColInfo
(
&
context
.
tags
);
return
code
;
return
code
;
}
}
source/libs/parser/src/parInsertUtil.c
浏览文件 @
b686e1fd
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录