Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4dbc3245
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
未验证
提交
4dbc3245
编写于
12月 22, 2022
作者:
wmmhello
提交者:
GitHub
12月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'refact/submit_req_taosx' into refact/submit_req
上级
89455cf1
cbeec94b
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
181 addition
and
368 deletion
+181
-368
include/common/tdataformat.h
include/common/tdataformat.h
+3
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-0
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+45
-367
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+55
-0
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+76
-1
未找到文件。
include/common/tdataformat.h
浏览文件 @
4dbc3245
...
...
@@ -146,6 +146,9 @@ extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max,
int32_t
tColDataAddValueByBind
(
SColData
*
pColData
,
TAOS_MULTI_BIND
*
pBind
);
void
tColDataSortMerge
(
SArray
*
colDataArr
);
//for raw block
int32_t
tColDataAddValueByDataBlock
(
SColData
*
pColData
,
int8_t
type
,
int32_t
bytes
,
int32_t
nRows
,
char
*
lengthOrbitmap
,
char
*
data
);
// for encode/decode
int32_t
tPutColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
int32_t
tGetColData
(
uint8_t
*
pBuf
,
SColData
*
pColData
);
...
...
include/libs/parser/parser.h
浏览文件 @
4dbc3245
...
...
@@ -115,6 +115,8 @@ int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsS
char
*
tableName
,
const
char
*
sTableName
,
int32_t
sTableNameLen
,
int32_t
ttl
,
char
*
msgBuf
,
int16_t
msgBufLen
);
int32_t
smlBuildOutput
(
SQuery
*
handle
,
SHashObj
*
pVgHash
);
int
rawBlockBindData
(
SQuery
*
query
,
STableMeta
*
pTableMeta
,
SRetrieveTableRsp
*
pRsp
,
SVCreateTbReq
*
pCreateTb
);
int32_t
rewriteToVnodeModifyOpStmt
(
SQuery
*
pQuery
,
SArray
*
pBufArray
);
SArray
*
serializeVgroupsCreateTableBatch
(
SHashObj
*
pVgroupHashmap
);
SArray
*
serializeVgroupsDropTableBatch
(
SHashObj
*
pVgroupHashmap
);
...
...
source/client/src/clientRawBlockWrite.c
浏览文件 @
4dbc3245
此差异已折叠。
点击以展开。
source/common/src/tdataformat.c
浏览文件 @
4dbc3245
...
...
@@ -2091,6 +2091,61 @@ _exit:
return
code
;
}
int32_t
tColDataAddValueByDataBlock
(
SColData
*
pColData
,
int8_t
type
,
int32_t
bytes
,
int32_t
nRows
,
char
*
lengthOrbitmap
,
char
*
data
)
{
int32_t
code
=
0
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
// var-length data type
for
(
int32_t
i
=
0
;
i
<
nRows
;
++
i
)
{
int32_t
offset
=
*
((
int32_t
*
)
lengthOrbitmap
+
i
);
if
(
offset
==
-
1
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
(
uint8_t
*
)
varDataVal
(
data
+
offset
),
varDataLen
(
data
+
offset
));
}
}
}
else
{
// fixed-length data type
bool
allValue
=
true
;
bool
allNull
=
true
;
for
(
int32_t
i
=
0
;
i
<
nRows
;
++
i
)
{
if
(
!
colDataIsNull_f
(
lengthOrbitmap
,
i
)){
allNull
=
false
;
}
else
{
allValue
=
false
;
}
}
if
(
allValue
)
{
// optimize (todo)
for
(
int32_t
i
=
0
;
i
<
nRows
;
++
i
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
(
uint8_t
*
)
data
+
bytes
*
i
,
bytes
);
}
}
else
if
(
allNull
)
{
// optimize (todo)
for
(
int32_t
i
=
0
;
i
<
nRows
;
++
i
)
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
}
}
else
{
for
(
int32_t
i
=
0
;
i
<
nRows
;
++
i
)
{
if
(
colDataIsNull_f
(
lengthOrbitmap
,
i
))
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NULL
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
}
else
{
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_VALUE
](
pColData
,
(
uint8_t
*
)
data
+
bytes
*
i
,
bytes
);
}
}
}
}
_exit:
return
code
;
}
int32_t
tColDataAddValueByBind
(
SColData
*
pColData
,
TAOS_MULTI_BIND
*
pBind
)
{
int32_t
code
=
0
;
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
4dbc3245
...
...
@@ -20,6 +20,7 @@
#include "parUtil.h"
#include "querynodes.h"
#include "tRealloc.h"
#include "tdatablock.h"
typedef
struct
SBlockKeyTuple
{
TSKEY
skey
;
...
...
@@ -295,7 +296,7 @@ int32_t insGetDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, in
}
if
(
*
dataBlocks
==
NULL
)
{
int32_t
ret
=
createDataBlock
((
size_t
)
size
,
rowSize
,
startOffset
,
pTableMeta
,
dataBlocks
);
int32_t
ret
=
create
Table
DataBlock
((
size_t
)
size
,
rowSize
,
startOffset
,
pTableMeta
,
dataBlocks
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
@@ -1371,3 +1372,77 @@ int32_t insBuildVgDataBlocks(SHashObj* pVgroupsHashObj, SArray* pVgDataCxtList,
return
code
;
}
int
rawBlockBindData
(
SQuery
*
query
,
STableMeta
*
pTableMeta
,
SRetrieveTableRsp
*
pRsp
,
SVCreateTbReq
*
pCreateTb
){
STableDataCxt
*
pTableCxt
=
NULL
;
int
ret
=
insGetTableDataCxt
(((
SVnodeModifOpStmt
*
)(
query
->
pRoot
))
->
pTableBlockHashObj
,
&
pTableMeta
->
uid
,
sizeof
(
pTableMeta
->
uid
),
pTableMeta
,
&
pCreateTb
,
&
pTableCxt
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"insGetTableDataCxt error"
);
goto
end
;
}
// no need to bind, because select * get all fields
ret
=
initTableColSubmitData
(
pTableCxt
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"initTableColSubmitData error"
);
goto
end
;
}
char
*
p
=
(
char
*
)
pRsp
->
data
;
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column length |
p
+=
sizeof
(
int32_t
);
p
+=
sizeof
(
int32_t
);
int32_t
numOfRows
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
int32_t
numOfCols
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
p
+=
sizeof
(
int32_t
);
p
+=
sizeof
(
uint64_t
);
int8_t
*
fields
=
p
;
p
+=
numOfCols
*
(
sizeof
(
int8_t
)
+
sizeof
(
int32_t
));
int32_t
*
colLength
=
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
)
*
numOfCols
;
char
*
pStart
=
p
;
SSchema
*
pSchema
=
getTableColumnSchema
(
pTableCxt
->
pMeta
);
SBoundColInfo
*
boundInfo
=
&
pTableCxt
->
boundColsInfo
;
if
(
boundInfo
->
numOfBound
!=
numOfCols
){
uError
(
"boundInfo->numOfBound:%d != numOfCols:%d"
,
boundInfo
->
numOfBound
,
numOfCols
);
ret
=
TSDB_CODE_INVALID_PARA
;
goto
end
;
}
for
(
int
c
=
0
;
c
<
boundInfo
->
numOfBound
;
++
c
)
{
SSchema
*
pColSchema
=
&
pSchema
[
boundInfo
->
pColIndex
[
c
]];
SColData
*
pCol
=
taosArrayGet
(
pTableCxt
->
pData
->
aCol
,
c
);
if
(
*
fields
!=
pColSchema
->
type
&&
*
(
int32_t
*
)(
fields
+
sizeof
(
int8_t
))
!=
pColSchema
->
bytes
)
{
uError
(
"type or bytes not equal"
);
ret
=
TSDB_CODE_INVALID_PARA
;
goto
end
;
}
colLength
[
c
]
=
htonl
(
colLength
[
c
]);
int8_t
*
offset
=
pStart
;
if
(
IS_VAR_DATA_TYPE
(
pColSchema
->
type
))
{
pStart
+=
numOfRows
*
sizeof
(
int32_t
);
}
else
{
pStart
+=
BitmapLen
(
numOfRows
);
}
char
*
pData
=
pStart
;
tColDataAddValueByDataBlock
(
pCol
,
pColSchema
->
type
,
pColSchema
->
bytes
,
numOfRows
,
offset
,
pData
);
fields
+=
sizeof
(
int8_t
)
+
sizeof
(
int32_t
);
pStart
+=
colLength
[
c
];
}
end:
return
ret
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录