Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c0e31d6c
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0e31d6c
编写于
3月 26, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-32] fix bugs in projection query
上级
f7434783
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
181 addition
and
190 deletion
+181
-190
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+37
-21
src/query/inc/queryExecutor.h
src/query/inc/queryExecutor.h
+17
-11
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+119
-156
src/vnode/tsdb/src/tsdbRead.c
src/vnode/tsdb/src/tsdbRead.c
+8
-2
未找到文件。
src/dnode/src/dnodeRead.c
浏览文件 @
c0e31d6c
...
...
@@ -226,12 +226,26 @@ static void dnodeProcessReadResult(SReadMsg *pRead) {
rpcFreeCont
(
pRead
->
rpcMsg
.
pCont
);
// free the received message
}
static
void
dnodeContinueExecuteQuery
(
void
*
qhandle
,
SReadMsg
*
pMsg
)
{
SReadMsg
readMsg
=
{
.
rpcMsg
=
{.
msgType
=
TSDB_MSG_TYPE_QUERY
},
.
pCont
=
qhandle
,
.
contLen
=
0
,
.
pRpcContext
=
pMsg
->
pRpcContext
,
.
pVnode
=
pMsg
->
pVnode
,
};
taos_queue
queue
=
dnodeGetVnodeRworker
(
pMsg
->
pVnode
);
taosWriteQitem
(
queue
,
&
readMsg
);
}
static
void
dnodeProcessQueryMsg
(
SReadMsg
*
pMsg
)
{
SQueryTableMsg
*
pQueryTableMsg
=
(
SQueryTableMsg
*
)
pMsg
->
pCont
;
SQInfo
*
pQInfo
=
NULL
;
if
(
pMsg
->
rpcMsg
.
contLen
!=
0
)
{
void
*
tsdb
=
dnodeGetVnodeTsdb
(
pMsg
->
pVnode
);
int32_t
code
=
qCreateQueryInfo
(
tsdb
,
pQueryTable
Msg
,
&
pQInfo
);
int32_t
code
=
qCreateQueryInfo
(
tsdb
,
pQueryTableMsg
,
p
Msg
,
&
pQInfo
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
code
;
...
...
@@ -246,27 +260,25 @@ static void dnodeProcessQueryMsg(SReadMsg *pMsg) {
};
rpcSendResponse
(
&
rpcRsp
);
}
else
{
pQInfo
=
pMsg
->
pCont
;
}
// do execute query
qTableQuery
(
pQInfo
);
}
static
int32_t
c
=
0
;
static
void
dnodeProcessRetrieveMsg
(
SReadMsg
*
pMsg
)
{
SRetrieveTableMsg
*
pRetrieve
=
pMsg
->
pCont
;
void
*
pQInfo
=
(
void
*
)
htobe64
(
pRetrieve
->
qhandle
);
dTrace
(
"QInfo:%p vgId:%d, retrieve msg is received"
,
pQInfo
,
pRetrieve
->
header
.
vgId
);
if
((
++
c
)
%
2
==
0
)
{
int32_t
k
=
1
;
}
int32_t
rowSize
=
0
;
int32_t
numOfRows
=
0
;
int32_t
contLen
=
0
;
SRetrieveTableRsp
*
pRsp
=
NULL
;
int32_t
code
=
qRetrieveQueryResultInfo
(
pQInfo
,
&
numOfRows
,
&
rowSize
);
int32_t
code
=
qRetrieveQueryResultInfo
(
pQInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
contLen
=
sizeof
(
SRetrieveTableRsp
);
...
...
@@ -275,6 +287,10 @@ static void dnodeProcessRetrieveMsg(SReadMsg *pMsg) {
}
else
{
// todo check code and handle error in build result set
code
=
qDumpRetrieveResult
(
pQInfo
,
&
pRsp
,
&
contLen
);
if
(
qNeedFurtherExec
(
pQInfo
))
{
dnodeContinueExecuteQuery
(
pQInfo
,
pMsg
);
}
}
SRpcMsg
rpcRsp
=
(
SRpcMsg
)
{
...
...
src/query/inc/queryExecutor.h
浏览文件 @
c0e31d6c
...
...
@@ -68,8 +68,10 @@ typedef struct SWindowResult {
}
SWindowResult
;
typedef
struct
SResultRec
{
int64_t
pointsTotal
;
int64_t
pointsRead
;
int64_t
total
;
int64_t
size
;
int64_t
capacity
;
int32_t
threshold
;
// the threshold size, when the number of rows in result buffer, return to client
}
SResultRec
;
typedef
struct
SWindowResInfo
{
...
...
@@ -143,7 +145,6 @@ typedef struct SQuery {
int32_t
pos
;
int64_t
pointsOffset
;
// the number of points offset to save read data
SData
**
sdata
;
int32_t
capacity
;
SSingleColumnFilterInfo
*
pFilterInfo
;
}
SQuery
;
...
...
@@ -171,15 +172,13 @@ typedef struct SQueryRuntimeEnv {
typedef
struct
SQInfo
{
void
*
signature
;
void
*
p
Vnode
;
void
*
p
aram
;
// pointer to the RpcReadMsg
TSKEY
startTime
;
TSKEY
elapsedTime
;
SResultRec
rec
;
int32_t
pointsInterpo
;
int32_t
code
;
// error code to returned to client
// int32_t killed; // denotes if current query is killed
sem_t
dataReady
;
SArray
*
pTableIdList
;
// table list
SArray
*
pTableIdList
;
// table
id
list
SQueryRuntimeEnv
runtimeEnv
;
int32_t
subgroupIdx
;
int32_t
offset
;
/* offset in group result set of subgroup */
...
...
@@ -204,7 +203,7 @@ typedef struct SQInfo {
* @param pQInfo
* @return
*/
int32_t
qCreateQueryInfo
(
void
*
pVnode
,
SQueryTableMsg
*
pQueryTableMsg
,
SQInfo
**
pQInfo
);
int32_t
qCreateQueryInfo
(
void
*
pVnode
,
SQueryTableMsg
*
pQueryTableMsg
,
void
*
param
,
SQInfo
**
pQInfo
);
/**
* query on single table
...
...
@@ -222,7 +221,7 @@ void qSuperTableQuery(void* pReadMsg);
* wait for the query completed, and retrieve final results to client
* @param pQInfo
*/
int32_t
qRetrieveQueryResultInfo
(
SQInfo
*
pQInfo
,
int32_t
*
numOfRows
,
int32_t
*
rowsize
);
int32_t
qRetrieveQueryResultInfo
(
SQInfo
*
pQInfo
);
/**
*
...
...
@@ -232,4 +231,11 @@ int32_t qRetrieveQueryResultInfo(SQInfo* pQInfo, int32_t *numOfRows, int32_t* ro
*/
int32_t
qDumpRetrieveResult
(
SQInfo
*
pQInfo
,
SRetrieveTableRsp
**
pRsp
,
int32_t
*
contLen
);
/**
*
* @param pQInfo
* @return
*/
bool
qNeedFurtherExec
(
SQInfo
*
pQInfo
);
#endif // TDENGINE_QUERYEXECUTOR_H
src/query/src/queryExecutor.c
浏览文件 @
c0e31d6c
此差异已折叠。
点击以展开。
src/vnode/tsdb/src/tsdbRead.c
浏览文件 @
c0e31d6c
...
...
@@ -124,6 +124,7 @@ typedef struct STsdbQueryHandle {
int32_t
tableIndex
;
bool
isFirstSlot
;
void
*
qinfo
;
// query info handle, for debug purpose
SSkipListIterator
*
memIter
;
}
STsdbQueryHandle
;
int32_t
doAllocateBuf
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
rowsPerFileBlock
)
{
...
...
@@ -367,8 +368,13 @@ SDataBlockInfo tsdbRetrieveDataBlockInfo(tsdb_query_handle_t *pQueryHandle) {
int32_t
rows
=
0
;
if
(
pTable
->
mem
!=
NULL
)
{
SSkipListIterator
*
iter
=
tSkipListCreateIter
(
pTable
->
mem
->
pData
);
rows
=
tsdbReadRowsFromCache
(
iter
,
INT64_MAX
,
4000
,
&
skey
,
&
ekey
,
pHandle
);
// create mem table iterator if it is not created yet
if
(
pHandle
->
memIter
==
NULL
)
{
pHandle
->
memIter
=
tSkipListCreateIter
(
pTable
->
mem
->
pData
);
}
rows
=
tsdbReadRowsFromCache
(
pHandle
->
memIter
,
INT64_MAX
,
2
,
&
skey
,
&
ekey
,
pHandle
);
}
SDataBlockInfo
blockInfo
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录