Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
13f1efd8
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
13f1efd8
编写于
4月 17, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-98] extract the query.h, and add it into the global inc folder
上级
33dbf051
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
102 addition
and
60 deletion
+102
-60
src/inc/query.h
src/inc/query.h
+97
-0
src/query/inc/queryExecutor.h
src/query/inc/queryExecutor.h
+0
-44
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+1
-10
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+2
-4
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+2
-2
未找到文件。
src/inc/query.h
0 → 100644
浏览文件 @
13f1efd8
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_QUERY_H
#define TDENGINE_QUERY_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "hash.h"
#include "tsdb.h"
#include "qinterpolation.h"
#include "qresultBuf.h"
#include "qsqlparser.h"
#include "qtsbuf.h"
#include "taosdef.h"
#include "tref.h"
#include "tsqlfunction.h"
#include "tarray.h"
typedef
void
*
qinfo_t
;
/**
* create the qinfo object according to QueryTableMsg
* @param pVnode
* @param pQueryTableMsg
* @param pQInfo
* @return
*/
int32_t
qCreateQueryInfo
(
void
*
pVnode
,
SQueryTableMsg
*
pQueryTableMsg
,
qinfo_t
*
pQInfo
);
/**
* Destroy QInfo object
*
* @param pQInfo
* @return
*/
void
qDestroyQueryInfo
(
qinfo_t
pQInfo
);
/**
* the main query execution function, including query on both table and multitables,
* which are decided according to the tag or table name query conditions
*
* @param pQInfo
* @return
*/
void
qTableQuery
(
qinfo_t
pQInfo
);
/**
* Retrieve the produced results information, if current query is not paused or completed,
* this function will be blocked to wait for the query execution completed or paused,
* in which case enough results have been produced already.
*
* @param pQInfo
* @return
*/
int32_t
qRetrieveQueryResultInfo
(
qinfo_t
pQInfo
);
/**
*
* Retrieve the actual results to fill the response message payload.
* Note that this function must be executed after qRetrieveQueryResultInfo is invoked.
*
* @param pQInfo qinfo object
* @param pRsp response message
* @param contLen payload length
* @return
*/
int32_t
qDumpRetrieveResult
(
qinfo_t
pQInfo
,
SRetrieveTableRsp
**
pRsp
,
int32_t
*
contLen
);
/**
* Decide if more results will be produced or not
*
* @param pQInfo
* @return
*/
bool
qHasMoreResultsToRetrieve
(
qinfo_t
pQInfo
);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_QUERY_H
src/query/inc/queryExecutor.h
浏览文件 @
13f1efd8
...
...
@@ -109,8 +109,6 @@ typedef struct STableQueryInfo {
}
STableQueryInfo
;
typedef
struct
STableDataInfo
{
// int32_t numOfBlocks;
// int32_t start; // start block index
int32_t
tableIndex
;
int32_t
groupIdx
;
// group id in table list
STableQueryInfo
*
pTableQInfo
;
...
...
@@ -188,50 +186,8 @@ typedef struct SQInfo {
*/
int32_t
tableIndex
;
int32_t
numOfGroupResultPages
;
// STableDataInfo* pTableDataInfo;
TSKEY
*
tsList
;
}
SQInfo
;
/**
* create the qinfo object before adding the query task to each tsdb query worker
*
* @param pReadMsg
* @param pQInfo
* @return
*/
int32_t
qCreateQueryInfo
(
void
*
pVnode
,
SQueryTableMsg
*
pQueryTableMsg
,
SQInfo
**
pQInfo
);
/**
* destroy the query info struct
* @param pQInfo
*/
void
qDestroyQueryInfo
(
SQInfo
*
pQInfo
);
/**
* query on single table
* @param pReadMsg
*/
void
qTableQuery
(
SQInfo
*
pQInfo
);
/**
* wait for the query completed, and retrieve final results to client
* @param pQInfo
*/
int32_t
qRetrieveQueryResultInfo
(
SQInfo
*
pQInfo
);
/**
*
* @param pQInfo
* @param pRsp
* @return
*/
int32_t
qDumpRetrieveResult
(
SQInfo
*
pQInfo
,
SRetrieveTableRsp
**
pRsp
,
int32_t
*
contLen
);
/**
*
* @param pQInfo
* @return
*/
bool
qHasMoreResultsToRetrieve
(
SQInfo
*
pQInfo
);
#endif // TDENGINE_QUERYEXECUTOR_H
src/query/src/queryExecutor.c
浏览文件 @
13f1efd8
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<tsdbMain.h>
#include
"tsdbMain.h" //todo use TableId instead of STable object
#include "os.h"
#include "hash.h"
...
...
@@ -28,7 +28,6 @@
#include "qresultBuf.h"
#include "queryExecutor.h"
#include "queryUtil.h"
#include "tsdb.h"
#define DEFAULT_INTERN_BUF_SIZE 16384L
...
...
@@ -4754,14 +4753,6 @@ static void createTableDataInfo(SQInfo* pQInfo) {
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
// todo make sure the table are added the reference count to gauranteed that all involved tables are valid
// if (pQInfo->pTableDataInfo == NULL) {
// pQInfo->pTableDataInfo = (STableDataInfo *)calloc(1, sizeof(STableDataInfo) * pQInfo->groupInfo.numOfTables);
// if (pQInfo->pTableDataInfo == NULL) {
// dError("QInfo:%p failed to allocate memory, %s", pQInfo, strerror(errno));
// pQInfo->code = -TSDB_CODE_SERV_OUT_OF_MEMORY;
// return;
// }
size_t
numOfGroups
=
taosArrayGetSize
(
pQInfo
->
groupInfo
.
pGroupList
);
int32_t
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfGroups
;
++
i
)
{
// load all meter meta info
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
13f1efd8
...
...
@@ -20,10 +20,8 @@
#include "tutil.h"
#include "tcompare.h"
#include "../../../query/inc/qast.h"
#include "../../../query/inc/qextbuffer.h"
#include "../../../query/inc/tlosertree.h"
#include "../../../query/inc/tsqlfunction.h"
#include "../../../query/inc/qast.h" // todo move to common module
#include "../../../query/inc/tlosertree.h" // todo move to util module
#include "tsdb.h"
#include "tsdbMain.h"
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
13f1efd8
...
...
@@ -25,7 +25,7 @@
#include "dataformat.h"
#include "vnode.h"
#include "vnodeInt.h"
#include "query
Executor
.h"
#include "query.h"
static
int32_t
(
*
vnodeProcessReadMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
pCont
,
int32_t
contLen
,
SRspRet
*
pRet
);
static
int32_t
vnodeProcessQueryMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
int32_t
contLen
,
SRspRet
*
pRet
);
...
...
@@ -54,7 +54,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
int32_t
code
=
TSDB_CODE_SUCCESS
;
SQInfo
*
pQInfo
=
NULL
;
qinfo_t
pQInfo
=
NULL
;
if
(
contLen
!=
0
)
{
void
*
tsdb
=
vnodeGetTsdb
(
pVnode
);
pRet
->
code
=
qCreateQueryInfo
(
tsdb
,
pQueryTableMsg
,
&
pQInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录