Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f3b58913
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看板
提交
f3b58913
编写于
4月 19, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/mpeer
上级
9d899844
b4514c86
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
205 addition
and
360 deletion
+205
-360
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-2
src/inc/tsdb.h
src/inc/tsdb.h
+3
-17
src/query/inc/qast.h
src/query/inc/qast.h
+0
-2
src/query/inc/queryExecutor.h
src/query/inc/queryExecutor.h
+2
-2
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+178
-310
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+20
-27
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
f3b58913
...
...
@@ -4674,8 +4674,8 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
}
// No tables included. No results generated. Query results are empty.
if
(
pTableMetaInfo
->
pTableMeta
==
NULL
)
{
tscTrace
(
"%p no table in
metricmeta
, no output result"
,
pSql
);
if
(
pTableMetaInfo
->
vgroupList
->
numOfVgroups
==
0
)
{
tscTrace
(
"%p no table in
super table
, no output result"
,
pSql
);
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
}
...
...
src/inc/tsdb.h
浏览文件 @
f3b58913
...
...
@@ -145,6 +145,7 @@ typedef struct STableGroupList { // qualified table object list in group
typedef
struct
STsdbQueryCond
{
STimeWindow
twindow
;
int32_t
order
;
// desc/asc order to iterate the data block
int32_t
numOfCols
;
SColumnInfoData
*
colList
;
}
STsdbQueryCond
;
...
...
@@ -189,8 +190,7 @@ typedef void *TsdbPosT;
* @param pTableList table sid list
* @return
*/
TsdbQueryHandleT
*
tsdbQueryTables
(
TsdbRepoT
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupInfo
,
SArray
*
pColumnInfo
);
TsdbQueryHandleT
*
tsdbQueryTables
(
TsdbRepoT
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupInfo
);
/**
* move to next block
...
...
@@ -241,20 +241,6 @@ SArray *tsdbRetrieveDataBlock(TsdbQueryHandleT *pQueryHandle, SArray *pIdList);
*/
int32_t
tsdbResetQuery
(
TsdbQueryHandleT
*
pQueryHandle
,
STimeWindow
*
window
,
TsdbPosT
position
,
int16_t
order
);
/**
* return the access position of current query handle
* @param pQueryHandle
* @return
*/
int32_t
tsdbDataBlockSeek
(
TsdbQueryHandleT
*
pQueryHandle
,
TsdbPosT
pos
);
/**
* todo remove this function later
* @param pQueryHandle
* @return
*/
TsdbPosT
tsdbDataBlockTell
(
TsdbQueryHandleT
*
pQueryHandle
);
/**
* todo remove this function later
* @param pQueryHandle
...
...
@@ -292,7 +278,7 @@ SArray *tsdbGetTableList(TsdbQueryHandleT *pQueryHandle);
* @param pTagCond. tag query condition
*
*/
int32_t
tsdbQuery
Tags
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
STableGroupInfo
*
pGroupList
,
int32_t
tsdbQuery
ByTagsCond
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
STableGroupInfo
*
pGroupList
,
SColIndex
*
pColIndex
,
int32_t
numOfCols
);
int32_t
tsdbGetOneTableGroup
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
STableGroupInfo
*
pGroupInfo
);
...
...
src/query/inc/qast.h
浏览文件 @
f3b58913
...
...
@@ -30,8 +30,6 @@ extern "C" {
struct
tExprNode
;
struct
SSchema
;
struct
tSkipList
;
struct
tSkipListNode
;
enum
{
TSQL_NODE_EXPR
=
0x1
,
...
...
src/query/inc/queryExecutor.h
浏览文件 @
f3b58913
...
...
@@ -170,11 +170,11 @@ typedef struct SQInfo {
int32_t
pointsInterpo
;
int32_t
code
;
// error code to returned to client
sem_t
dataReady
;
STableGroupInfo
groupInfo
;
// table id list
void
*
tsdb
;
STableGroupInfo
groupInfo
;
// table id list
SQueryRuntimeEnv
runtimeEnv
;
int32_t
subgroupId
x
;
int32_t
groupInde
x
;
int32_t
offset
;
/* offset in group result set of subgroup */
T_REF_DECLARE
()
...
...
src/query/src/queryExecutor.c
浏览文件 @
f3b58913
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
f3b58913
...
...
@@ -134,7 +134,7 @@ static void tsdbInitCompBlockLoadInfo(SLoadCompBlockInfo* pCompBlockLoadInfo) {
pCompBlockLoadInfo
->
fileListIndex
=
-
1
;
}
TsdbQueryHandleT
*
tsdbQueryTables
(
TsdbRepoT
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
SArray
*
pColumnInfo
)
{
TsdbQueryHandleT
*
tsdbQueryTables
(
TsdbRepoT
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
)
{
// todo 1. filter not exist table
// todo 2. add the reference count for each table that is involved in query
...
...
@@ -148,7 +148,7 @@ TsdbQueryHandleT* tsdbQueryTables(TsdbRepoT* tsdb, STsdbQueryCond* pCond, STable
pQueryHandle
->
cur
.
fid
=
-
1
;
size_t
sizeOfGroup
=
taosArrayGetSize
(
groupList
->
pGroupList
);
assert
(
sizeOfGroup
>=
1
);
assert
(
sizeOfGroup
>=
1
&&
pCond
!=
NULL
&&
pCond
->
numOfCols
>
0
);
pQueryHandle
->
pTableCheckInfo
=
taosArrayInit
(
groupList
->
numOfTables
,
sizeof
(
STableCheckInfo
));
...
...
@@ -182,16 +182,15 @@ TsdbQueryHandleT* tsdbQueryTables(TsdbRepoT* tsdb, STsdbQueryCond* pCond, STable
pQueryHandle
->
activeIndex
=
0
;
// allocate buffer in order to load data blocks from file
int32_t
numOfCols
=
taosArrayGetSize
(
pColumnInfo
)
;
int32_t
numOfCols
=
pCond
->
numOfCols
;
size_t
bufferCapacity
=
4096
;
pQueryHandle
->
pColumns
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pColumnInfo
,
i
);
for
(
int32_t
i
=
0
;
i
<
pCond
->
numOfCols
;
++
i
)
{
SColumnInfoData
pDest
=
{{
0
},
0
};
pDest
.
pData
=
calloc
(
1
,
EXTRA_BYTES
+
bufferCapacity
*
pCol
->
info
.
bytes
)
;
pDest
.
info
=
pCol
->
info
;
pDest
.
info
=
pCond
->
colList
[
i
].
info
;
pDest
.
pData
=
calloc
(
1
,
EXTRA_BYTES
+
bufferCapacity
*
pCond
->
colList
[
i
].
info
.
bytes
)
;
taosArrayPush
(
pQueryHandle
->
pColumns
,
&
pDest
);
}
...
...
@@ -430,9 +429,6 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo
taosArrayDestroy
(
sa
);
tfree
(
data
);
// TSKEY* d = (TSKEY*)pCheckInfo->pDataCols->cols[PRIMARYKEY_TIMESTAMP_COL_INDEX].pData;
// assert(d[0] == pBlock->keyFirst && d[pBlock->numOfPoints - 1] == pBlock->keyLast);
return
blockLoaded
;
}
...
...
@@ -587,7 +583,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
}
}
//
int32_t start = MIN(cur->pos, endPos);
int32_t
start
=
MIN
(
cur
->
pos
,
endPos
);
// move the data block in the front to data block if needed
int32_t
numOfCols
=
QH_GET_NUM_OF_COLS
(
pQueryHandle
);
...
...
@@ -600,9 +596,9 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
if
(
pCol
->
info
.
colId
==
colId
)
{
// SDataCol* pDataCol = &pCols->cols[i];
pCol
->
pData
=
pQueryHandle
->
rhelper
.
pDataCols
[
0
]
->
cols
[
i
].
pData
;
// memmove(pCol->pData, pDataCol->
pData + pCol->info.bytes * start,
//
pQueryHandle->realNumOfRows * pCol->info.bytes);
// pCol->pData = pQueryHandle->rhelper.pDataCols[0]->cols[i].pData + pCol->info.bytes * start
;
memmove
(
pCol
->
pData
,
pQueryHandle
->
rhelper
.
pDataCols
[
0
]
->
cols
[
i
].
pData
+
pCol
->
info
.
bytes
*
start
,
pQueryHandle
->
realNumOfRows
*
pCol
->
info
.
bytes
);
break
;
}
}
...
...
@@ -941,7 +937,6 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pqHandle) {
return
getDataBlocksInFiles
(
pQueryHandle
);
}
}
static
int
tsdbReadRowsFromCache
(
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
TSKEY
*
skey
,
TSKEY
*
ekey
,
...
...
@@ -1053,7 +1048,7 @@ SDataBlockInfo tsdbRetrieveDataBlockInfo(TsdbQueryHandleT* pQueryHandle) {
if
(
pTable
->
mem
!=
NULL
)
{
// create mem table iterator if it is not created yet
assert
(
pCheckInfo
->
iter
!=
NULL
);
rows
=
tsdbReadRowsFromCache
(
pCheckInfo
->
iter
,
pHandle
->
window
.
ekey
,
2
,
&
skey
,
&
ekey
,
pHandle
);
rows
=
tsdbReadRowsFromCache
(
pCheckInfo
->
iter
,
pHandle
->
window
.
ekey
,
4000
,
&
skey
,
&
ekey
,
pHandle
);
// update the last key value
pCheckInfo
->
lastKey
=
ekey
+
step
;
...
...
@@ -1117,10 +1112,6 @@ int32_t tsdbResetQuery(TsdbQueryHandleT* pQueryHandle, STimeWindow* window, Tsdb
return
0
;
}
int32_t
tsdbDataBlockSeek
(
TsdbQueryHandleT
*
pQueryHandle
,
TsdbPosT
pos
)
{
return
0
;
}
TsdbPosT
tsdbDataBlockTell
(
TsdbQueryHandleT
*
pQueryHandle
)
{
return
NULL
;
}
SArray
*
tsdbRetrieveDataRow
(
TsdbQueryHandleT
*
pQueryHandle
,
SArray
*
pIdList
,
SQueryRowCond
*
pCond
)
{
return
NULL
;
}
TsdbQueryHandleT
*
tsdbQueryFromTagConds
(
STsdbQueryCond
*
pCond
,
int16_t
stableId
,
const
char
*
pTagFilterStr
)
{
...
...
@@ -1266,12 +1257,14 @@ int32_t tableGroupComparFn(const void *p1, const void *p2, const void *param) {
SColIndex
*
pColIndex
=
&
pTableGroupSupp
->
pCols
[
i
];
int32_t
colIndex
=
pColIndex
->
colIndex
;
assert
(
colIndex
>=
0
&&
colIndex
<
schemaNCols
(
pTableGroupSupp
->
pTagSchema
));
char
*
f1
=
NULL
;
char
*
f2
=
NULL
;
int32_t
type
=
0
;
int32_t
bytes
=
0
;
if
(
colIndex
==
-
1
)
{
// t
able name, todo fix
me
if
(
colIndex
==
-
1
)
{
// t
odo fix me, table na
me
// f1 = s1->tags;
// f2 = s2->tags;
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
@@ -1438,7 +1431,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
return
TSDB_CODE_SUCCESS
;
}
int32_t
tsdbQuery
Tags
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
STableGroupInfo
*
pGroupInfo
,
int32_t
tsdbQuery
ByTagsCond
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
STableGroupInfo
*
pGroupInfo
,
SColIndex
*
pColIndex
,
int32_t
numOfCols
)
{
STable
*
pSTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
...
...
@@ -1520,11 +1513,11 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
taosArrayDestroy
(
pQueryHandle
->
pTableCheckInfo
);
tfree
(
pQueryHandle
->
compIndex
);
//
size_t cols = taosArrayGetSize(pQueryHandle->pColumns);
//
for (int32_t i = 0; i < cols; ++i) {
//
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
// //
tfree(pColInfo->pData);
//
}
size_t
cols
=
taosArrayGetSize
(
pQueryHandle
->
pColumns
);
for
(
int32_t
i
=
0
;
i
<
cols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
tfree
(
pColInfo
->
pData
);
}
taosArrayDestroy
(
pQueryHandle
->
pColumns
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录