Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ddaae713
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看板
提交
ddaae713
编写于
3月 17, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-13039] support write in and retrieve from vnode.
上级
5fca3e47
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
179 addition
and
103 deletion
+179
-103
include/common/tdatablock.h
include/common/tdatablock.h
+2
-2
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+21
-12
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+66
-26
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+15
-12
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+17
-13
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+6
-1
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+38
-20
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+4
-4
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+3
-3
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+6
-2
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+1
-8
未找到文件。
include/common/tdatablock.h
浏览文件 @
ddaae713
...
...
@@ -106,7 +106,7 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock);
int32_t
blockDataFromBuf
(
SSDataBlock
*
pBlock
,
const
char
*
buf
);
size_t
blockDataGetSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetRowSize
(
SSDataBlock
*
pBlock
);
double
blockDataGetSerialRowSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetSerialMetaSize
(
const
SSDataBlock
*
pBlock
);
...
...
@@ -117,7 +117,7 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
int32_t
blockDataEnsureColumnCapacity
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
void
blockDataClea
r
up
(
SSDataBlock
*
pDataBlock
);
void
blockDataClea
n
up
(
SSDataBlock
*
pDataBlock
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
);
size_t
blockDataGetCapacityInRow
(
const
SSDataBlock
*
pBlock
,
size_t
pageSize
);
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
...
...
source/client/inc/clientInt.h
浏览文件 @
ddaae713
...
...
@@ -141,18 +141,27 @@ typedef struct STscObj {
SAppInstInfo
*
pAppInfo
;
}
STscObj
;
typedef
struct
SResultColumn
{
union
{
char
*
nullbitmap
;
// bitmap, one bit for each item in the list
int32_t
*
offset
;
};
char
*
pData
;
}
SResultColumn
;
typedef
struct
SReqResultInfo
{
const
char
*
pRspMsg
;
const
char
*
pData
;
TAOS_FIELD
*
fields
;
uint32_t
numOfCols
;
int32_t
*
length
;
TAOS_ROW
row
;
char
**
pCol
;
uint32_t
numOfRows
;
uint64_t
totalRows
;
uint32_t
current
;
bool
completed
;
const
char
*
pRspMsg
;
const
char
*
pData
;
TAOS_FIELD
*
fields
;
uint32_t
numOfCols
;
int32_t
*
length
;
TAOS_ROW
row
;
SResultColumn
*
pCol
;
uint32_t
numOfRows
;
uint64_t
totalRows
;
uint32_t
current
;
bool
completed
;
int32_t
payloadLen
;
}
SReqResultInfo
;
typedef
struct
SShowReqInfo
{
...
...
@@ -224,7 +233,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
void
*
doFetchRow
(
SRequestObj
*
pRequest
);
void
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
...
...
source/client/src/clientImpl.c
浏览文件 @
ddaae713
...
...
@@ -14,7 +14,7 @@
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
static
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
);
static
void
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
);
static
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
);
static
bool
stringLengthCheck
(
const
char
*
str
,
size_t
maxsize
)
{
if
(
str
==
NULL
)
{
...
...
@@ -483,13 +483,16 @@ void* doFetchRow(SRequestObj* pRequest) {
}
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
int32_t
code
=
schedulerFetchRows
(
pRequest
->
body
.
queryJob
,
(
void
**
)
&
pResInfo
->
pData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pRequest
->
code
=
code
;
pRequest
->
code
=
schedulerFetchRows
(
pRequest
->
body
.
queryJob
,
(
void
**
)
&
pResInfo
->
pData
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
pRequest
->
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResInfo
->
pData
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResInfo
->
pData
);
tscDebug
(
"0x%"
PRIx64
" fetch results, numOfRows:%d total Rows:%"
PRId64
", complete:%d, reqId:0x%"
PRIx64
,
pRequest
->
self
,
pResInfo
->
numOfRows
,
pResInfo
->
totalRows
,
pResInfo
->
completed
,
pRequest
->
requestId
);
...
...
@@ -556,10 +559,23 @@ void* doFetchRow(SRequestObj* pRequest) {
_return:
for
(
int32_t
i
=
0
;
i
<
pResultInfo
->
numOfCols
;
++
i
)
{
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
]
+
pResultInfo
->
fields
[
i
].
bytes
*
pResultInfo
->
current
;
SResultColumn
*
pCol
=
&
pResultInfo
->
pCol
[
i
];
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
pResultInfo
->
length
[
i
]
=
varDataLen
(
pResultInfo
->
row
[
i
]);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pResultInfo
->
row
[
i
]);
if
(
pCol
->
offset
[
pResultInfo
->
current
]
!=
-
1
)
{
char
*
pStart
=
pResultInfo
->
pCol
[
i
].
offset
[
pResultInfo
->
current
]
+
pResultInfo
->
pCol
[
i
].
pData
;
pResultInfo
->
length
[
i
]
=
varDataLen
(
pStart
);
pResultInfo
->
row
[
i
]
=
varDataVal
(
pStart
);
}
else
{
pResultInfo
->
row
[
i
]
=
NULL
;
}
}
else
{
if
(
!
colDataIsNull_f
(
pCol
->
nullbitmap
,
pResultInfo
->
current
))
{
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
+
pResultInfo
->
fields
[
i
].
bytes
*
pResultInfo
->
current
;
}
else
{
pResultInfo
->
row
[
i
]
=
NULL
;
}
}
}
...
...
@@ -567,30 +583,52 @@ _return:
return
pResultInfo
->
row
;
}
static
void
doPrepareResPtr
(
SReqResultInfo
*
pResInfo
)
{
static
int32_t
doPrepareResPtr
(
SReqResultInfo
*
pResInfo
)
{
if
(
pResInfo
->
row
==
NULL
)
{
pResInfo
->
row
=
calloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
pCol
=
calloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
row
=
calloc
(
pResInfo
->
numOfCols
,
POINTER_BYTES
);
pResInfo
->
pCol
=
calloc
(
pResInfo
->
numOfCols
,
sizeof
(
SResultColumn
)
);
pResInfo
->
length
=
calloc
(
pResInfo
->
numOfCols
,
sizeof
(
int32_t
));
}
if
(
pResInfo
->
row
==
NULL
||
pResInfo
->
pCol
==
NULL
||
pResInfo
->
length
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
return
TSDB_CODE_SUCCESS
;
}
}
void
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
)
{
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
)
{
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
if
(
numOfRows
==
0
)
{
return
;
return
TSDB_CODE_SUCCESS
;
}
// todo check for the failure of malloc
doPrepareResPtr
(
pResultInfo
);
int32_t
code
=
doPrepareResPtr
(
pResultInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
offset
=
0
;
int32_t
*
colLength
=
(
int32_t
*
)
pResultInfo
->
pData
;
char
*
pStart
=
((
char
*
)
pResultInfo
->
pData
)
+
sizeof
(
int32_t
)
*
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
colLength
[
i
]
=
htonl
(
colLength
[
i
]);
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
pResultInfo
->
pCol
[
i
].
offset
=
(
int32_t
*
)
pStart
;
pStart
+=
numOfRows
*
sizeof
(
int32_t
);
}
else
{
pResultInfo
->
pCol
[
i
].
nullbitmap
=
pStart
;
pStart
+=
BitmapLen
(
pResultInfo
->
numOfRows
);
}
pResultInfo
->
pCol
[
i
].
pData
=
pStart
;
pResultInfo
->
length
[
i
]
=
pResultInfo
->
fields
[
i
].
bytes
;
pResultInfo
->
row
[
i
]
=
(
char
*
)(
pResultInfo
->
pData
+
offset
*
pResultInfo
->
numOfRows
)
;
pResultInfo
->
pCol
[
i
]
=
pResultInfo
->
row
[
i
];
offset
+=
pResultInfo
->
fields
[
i
].
bytes
;
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
pStart
+=
colLength
[
i
]
;
}
return
TSDB_CODE_SUCCESS
;
}
char
*
getDbOfConnection
(
STscObj
*
pObj
)
{
...
...
@@ -612,15 +650,17 @@ void setConnectionDB(STscObj* pTscObj, const char* db) {
pthread_mutex_unlock
(
&
pTscObj
->
mutex
);
}
void
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
)
{
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
)
{
assert
(
pResultInfo
!=
NULL
&&
pRsp
!=
NULL
);
pResultInfo
->
pRspMsg
=
(
const
char
*
)
pRsp
;
pResultInfo
->
pData
=
(
void
*
)
pRsp
->
data
;
pResultInfo
->
numOfRows
=
htonl
(
pRsp
->
numOfRows
);
pResultInfo
->
current
=
0
;
pResultInfo
->
completed
=
(
pRsp
->
completed
==
1
);
pResultInfo
->
pRspMsg
=
(
const
char
*
)
pRsp
;
pResultInfo
->
pData
=
(
void
*
)
pRsp
->
data
;
pResultInfo
->
numOfRows
=
htonl
(
pRsp
->
numOfRows
);
pResultInfo
->
current
=
0
;
pResultInfo
->
completed
=
(
pRsp
->
completed
==
1
);
pResultInfo
->
payloadLen
=
htonl
(
pRsp
->
compLen
);
// TODO handle the compressed case
pResultInfo
->
totalRows
+=
pResultInfo
->
numOfRows
;
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
);
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
);
}
source/client/test/clientTests.cpp
浏览文件 @
ddaae713
...
...
@@ -52,7 +52,7 @@ TEST(testCase, driverInit_Test) {
// taosInitGlobalCfg();
// taos_init();
}
#if 0
TEST(testCase, connect_Test) {
// taos_options(TSDB_OPTION_CONFIGDIR, "/home/ubuntu/first/cfg");
...
...
@@ -648,6 +648,7 @@ TEST(testCase, projection_query_stables) {
taos_free_result(pRes);
taos_close(pConn);
}
#endif
TEST
(
testCase
,
agg_query_tables
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
...
@@ -656,18 +657,20 @@ TEST(testCase, agg_query_tables) {
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table tx using st1 tags(111111111111111)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create table, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"select * from tu"
);
pRes
=
taos_query
(
pConn
,
"select count(*) from t_x_19"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to select from table, reason:%s
\n
"
,
taos_errstr
(
pRes
));
taos_free_result
(
pRes
);
ASSERT_TRUE
(
false
);
}
// pRes = taos_query(pConn, "create table tx using st1 tags(111111111111111)");
// if (taos_errno(pRes) != 0) {
// printf("failed to create table, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "select count(*) from tu");
// if (taos_errno(pRes) != 0) {
// printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
TAOS_ROW
pRow
=
NULL
;
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
...
...
source/common/src/tdatablock.c
浏览文件 @
ddaae713
...
...
@@ -430,11 +430,11 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
/**
*
* +------------------+---------------
+
--------------------+
* |the number of rows|
column length | column #1
|
* | (4 bytes) |
(4 bytes) |------------
--------+
* | |
| null bitmap| values
|
* +------------------+------------
---+------------
--------+
* +------------------+---------------
----------
--------------------+
* |the number of rows|
column #1
|
* | (4 bytes) |
------------+-----------------------+
--------+
* | |
null bitmap| column length(4bytes) | values
|
* +------------------+------------
+-----------------------+
--------+
* @param buf
* @param pBlock
* @return
...
...
@@ -515,17 +515,21 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
return
TSDB_CODE_SUCCESS
;
}
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
)
{
size_t
blockDataGetRowSize
(
SSDataBlock
*
pBlock
)
{
ASSERT
(
pBlock
!=
NULL
);
size_t
rowSize
=
0
;
if
(
pBlock
->
info
.
rowSize
==
0
)
{
size_t
rowSize
=
0
;
size_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
rowSize
+=
pColInfo
->
info
.
bytes
;
size_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
rowSize
+=
pColInfo
->
info
.
bytes
;
}
pBlock
->
info
.
rowSize
=
rowSize
;
}
return
rowSize
;
return
pBlock
->
info
.
rowSize
;
}
/**
...
...
@@ -1059,7 +1063,7 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
// destroyTupleIndex(index);
}
void
blockDataClea
r
up
(
SSDataBlock
*
pDataBlock
)
{
void
blockDataClea
n
up
(
SSDataBlock
*
pDataBlock
)
{
pDataBlock
->
info
.
rows
=
0
;
if
(
pDataBlock
->
info
.
hasVarCol
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
ddaae713
...
...
@@ -404,7 +404,12 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond,
colInfo
.
info
=
pCond
->
colList
[
i
];
colInfo
.
pData
=
calloc
(
1
,
EXTRA_BYTES
+
pReadHandle
->
outputCapacity
*
pCond
->
colList
[
i
].
bytes
);
if
(
colInfo
.
pData
==
NULL
)
{
if
(
!
IS_VAR_DATA_TYPE
(
colInfo
.
info
.
type
))
{
colInfo
.
nullbitmap
=
calloc
(
1
,
BitmapLen
(
pReadHandle
->
outputCapacity
));
}
if
(
colInfo
.
pData
==
NULL
||
(
colInfo
.
nullbitmap
==
NULL
&&
(
!
IS_VAR_DATA_TYPE
(
colInfo
.
info
.
type
))))
{
goto
_end
;
}
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
ddaae713
...
...
@@ -15,11 +15,12 @@
#include "dataSinkInt.h"
#include "dataSinkMgt.h"
#include "executorimpl.h"
#include "planner.h"
#include "tcompression.h"
#include "tglobal.h"
#include "tqueue.h"
#include "
executorimpl
.h"
#include "
tdatablock
.h"
typedef
struct
SDataDispatchBuf
{
int32_t
useSize
;
...
...
@@ -64,29 +65,47 @@ static bool needCompress(const SSDataBlock* pData, const SDataBlockDescNode* pSc
}
static
int32_t
compressColData
(
SColumnInfoData
*
pColRes
,
int32_t
numOfRows
,
char
*
data
,
int8_t
compressed
)
{
int32_t
colSize
=
pColRes
->
info
.
bytes
*
numOfRows
;
int32_t
colSize
=
colDataGetLength
(
pColRes
,
numOfRows
)
;
return
(
*
(
tDataTypes
[
pColRes
->
info
.
type
].
compFunc
))(
pColRes
->
pData
,
colSize
,
numOfRows
,
data
,
colSize
+
COMP_OVERFLOW_BYTES
,
compressed
,
NULL
,
0
);
}
static
void
copyData
(
const
SInputData
*
pInput
,
const
SDataBlockDescNode
*
pSchema
,
char
*
data
,
int8_t
compressed
,
int32_t
*
comp
Len
)
{
static
void
copyData
(
const
SInputData
*
pInput
,
const
SDataBlockDescNode
*
pSchema
,
char
*
data
,
int8_t
compressed
,
int32_t
*
data
Len
)
{
int32_t
numOfCols
=
LIST_LENGTH
(
pSchema
->
pSlots
);
int32_t
*
compSizes
=
(
int32_t
*
)
data
;
if
(
compressed
)
{
data
+=
numOfCols
*
sizeof
(
int32_t
);
}
int32_t
*
colSizes
=
(
int32_t
*
)
data
;
data
+=
numOfCols
*
sizeof
(
int32_t
);
*
dataLen
=
(
numOfCols
*
sizeof
(
int32_t
));
int32_t
numOfRows
=
pInput
->
pData
->
info
.
rows
;
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
taosArrayGet
(
pInput
->
pData
->
pDataBlock
,
col
);
// copy the null bitmap
if
(
IS_VAR_DATA_TYPE
(
pColRes
->
info
.
type
))
{
size_t
metaSize
=
numOfRows
*
sizeof
(
int32_t
);
memcpy
(
data
,
pColRes
->
varmeta
.
offset
,
metaSize
);
data
+=
metaSize
;
(
*
dataLen
)
+=
metaSize
;
}
else
{
int32_t
len
=
BitmapLen
(
numOfRows
);
memcpy
(
data
,
pColRes
->
nullbitmap
,
len
);
data
+=
len
;
(
*
dataLen
)
+=
len
;
}
if
(
compressed
)
{
compSizes
[
col
]
=
compressColData
(
pColRes
,
pInput
->
pData
->
info
.
rows
,
data
,
compressed
);
data
+=
compSizes
[
col
];
*
compLen
+=
compSizes
[
col
];
compSizes
[
col
]
=
htonl
(
compSizes
[
col
]);
colSizes
[
col
]
=
compressColData
(
pColRes
,
numOfRows
,
data
,
compressed
);
data
+=
colSizes
[
col
];
(
*
dataLen
)
+=
colSizes
[
col
];
}
else
{
memmove
(
data
,
pColRes
->
pData
,
pColRes
->
info
.
bytes
*
pInput
->
pData
->
info
.
rows
);
data
+=
pColRes
->
info
.
bytes
*
pInput
->
pData
->
info
.
rows
;
colSizes
[
col
]
=
colDataGetLength
(
pColRes
,
numOfRows
);
(
*
dataLen
)
+=
colSizes
[
col
];
memmove
(
data
,
pColRes
->
pData
,
colSizes
[
col
]);
data
+=
colSizes
[
col
];
}
colSizes
[
col
]
=
htonl
(
colSizes
[
col
]);
}
}
...
...
@@ -95,16 +114,14 @@ static void copyData(const SInputData* pInput, const SDataBlockDescNode* pSchema
static
void
toDataCacheEntry
(
const
SDataDispatchHandle
*
pHandle
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
pEntry
->
compressed
=
(
int8_t
)
needCompress
(
pInput
->
pData
,
pHandle
->
pSchema
);
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
dataLen
=
0
;
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
dataLen
=
0
;
pBuf
->
useSize
=
sizeof
(
SRetrieveTableRsp
);
copyData
(
pInput
,
pHandle
->
pSchema
,
pEntry
->
data
,
pEntry
->
compressed
,
&
pEntry
->
dataLen
);
if
(
0
==
pEntry
->
compressed
)
{
pEntry
->
dataLen
=
pHandle
->
pSchema
->
resultRowSize
*
pInput
->
pData
->
info
.
rows
;
}
pBuf
->
useSize
+=
pEntry
->
dataLen
;
// todo completed
pEntry
->
dataLen
=
pEntry
->
dataLen
;
pBuf
->
useSize
+=
pEntry
->
dataLen
;
}
static
bool
allocBuf
(
SDataDispatchHandle
*
pDispatcher
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
...
...
@@ -169,6 +186,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
*
pLen
=
0
;
return
;
}
SDataDispatchBuf
*
pBuf
=
NULL
;
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ddaae713
...
...
@@ -3986,7 +3986,7 @@ static int32_t doCopyToSDataBlock(SDiskbasedBuf *pBuf, SGroupResInfo* pGroupResI
static
void
toSDatablock
(
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
,
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
,
int32_t
*
rowCellOffset
)
{
assert
(
pGroupResInfo
->
currentGroup
<=
pGroupResInfo
->
totalGroup
);
blockDataClea
r
up
(
pBlock
);
blockDataClea
n
up
(
pBlock
);
if
(
!
hasRemainDataInCurrentGroup
(
pGroupResInfo
))
{
return
;
}
...
...
@@ -5794,7 +5794,7 @@ static void appendOneRowToDataBlock(SSDataBlock *pBlock, STupleHandle* pTupleHan
}
static
SSDataBlock
*
getSortedBlockData
(
SSortHandle
*
pHandle
,
SSDataBlock
*
pDataBlock
,
bool
hasVarCol
,
int32_t
capacity
)
{
blockDataClea
r
up
(
pDataBlock
);
blockDataClea
n
up
(
pDataBlock
);
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
tsortNextTuple
(
pHandle
);
...
...
@@ -5950,7 +5950,7 @@ static SSDataBlock* doMerge(SOperatorInfo* pOperator) {
while
(
1
)
{
blockDataClea
r
up
(
pDataBlock
);
blockDataClea
n
up
(
pDataBlock
);
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
tsortNextTuple
(
pHandle
);
if
(
pTupleHandle
==
NULL
)
{
...
...
@@ -6366,7 +6366,7 @@ static SSDataBlock* doProjectOperation(SOperatorInfo *pOperator, bool* newgroup)
SOptrBasicInfo
*
pInfo
=
&
pProjectInfo
->
binfo
;
SSDataBlock
*
pRes
=
pInfo
->
pRes
;
blockDataClea
r
up
(
pRes
);
blockDataClea
n
up
(
pRes
);
if
(
pProjectInfo
->
existDataBlock
)
{
// TODO refactor
// STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
ddaae713
...
...
@@ -182,7 +182,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
start
=
stop
+
1
;
}
blockDataClea
r
up
(
pDataBlock
);
blockDataClea
n
up
(
pDataBlock
);
SSDataBlock
*
pBlock
=
createOneDataBlock
(
pDataBlock
);
int32_t
code
=
doAddNewExternalMemSource
(
pHandle
->
pBuf
,
pHandle
->
pOrderedSource
,
pBlock
,
&
pHandle
->
sourceId
);
...
...
@@ -312,7 +312,7 @@ static int32_t adjustMergeTreeForNextTuple(SExternalMemSource *pSource, SMultiwa
}
static
SSDataBlock
*
getSortedBlockData
(
SSortHandle
*
pHandle
,
SMsortComparParam
*
cmpParam
,
int32_t
capacity
)
{
blockDataClea
r
up
(
pHandle
->
pDataBlock
);
blockDataClea
n
up
(
pHandle
->
pDataBlock
);
while
(
1
)
{
if
(
cmpParam
->
numOfSources
==
pHandle
->
numOfCompletedSources
)
{
...
...
@@ -478,7 +478,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
setBufPageDirty
(
pPage
,
true
);
releaseBufPage
(
pHandle
->
pBuf
,
pPage
);
blockDataClea
r
up
(
pDataBlock
);
blockDataClea
n
up
(
pDataBlock
);
}
tMergeTreeDestroy
(
pHandle
->
pMergeTree
);
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
ddaae713
...
...
@@ -453,7 +453,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
return
func
(
&
tmpVal
,
pSchema
->
bytes
,
param
);
}
return
func
(
getNullValue
(
pSchema
->
type
)
,
0
,
param
);
return
func
(
NULL
,
0
,
param
);
}
switch
(
pSchema
->
type
)
{
...
...
@@ -628,7 +628,11 @@ static FORCE_INLINE int32_t MemRowAppend(const void* value, int32_t len, void* p
varDataSetLen
(
rowEnd
,
output
);
tdAppendColValToRow
(
rb
,
pa
->
schema
->
colId
,
pa
->
schema
->
type
,
TD_VTYPE_NORM
,
rowEnd
,
false
,
pa
->
toffset
,
pa
->
colIdx
);
}
else
{
tdAppendColValToRow
(
rb
,
pa
->
schema
->
colId
,
pa
->
schema
->
type
,
TD_VTYPE_NORM
,
value
,
true
,
pa
->
toffset
,
pa
->
colIdx
);
if
(
value
==
NULL
)
{
// it is a null data
tdAppendColValToRow
(
rb
,
pa
->
schema
->
colId
,
pa
->
schema
->
type
,
TD_VTYPE_NULL
,
value
,
true
,
pa
->
toffset
,
pa
->
colIdx
);
}
else
{
tdAppendColValToRow
(
rb
,
pa
->
schema
->
colId
,
pa
->
schema
->
type
,
TD_VTYPE_NORM
,
value
,
true
,
pa
->
toffset
,
pa
->
colIdx
);
}
}
return
TSDB_CODE_SUCCESS
;
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
ddaae713
...
...
@@ -603,28 +603,21 @@ int32_t qwGetResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, void
}
QW_TASK_DLOG
(
"no data in sink and query end, phase:%d"
,
ctx
->
phase
);
QW_ERR_RET
(
qwUpdateTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_SUCCEED
));
QW_ERR_RET
(
qwMallocFetchRsp
(
len
,
&
rsp
));
*
rspMsg
=
rsp
;
*
dataLen
=
0
;
return
TSDB_CODE_SUCCESS
;
}
pOutput
->
bufStatus
=
DS_BUF_EMPTY
;
QW_TASK_DLOG
(
"no res data in sink, need response later, queryEnd:%d"
,
queryEnd
);
return
TSDB_CODE_SUCCESS
;
}
// Got data from sink
*
dataLen
=
len
;
QW_TASK_DLOG
(
"task got data in sink, dataLength:%d"
,
len
);
QW_ERR_RET
(
qwMallocFetchRsp
(
len
,
&
rsp
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录