Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
36837467
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
36837467
编写于
2月 28, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error in mem order desc
上级
c39380b1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
44 deletion
+25
-44
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+0
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-22
src/query/src/qUtil.c
src/query/src/qUtil.c
+2
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+21
-19
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
36837467
...
...
@@ -224,7 +224,6 @@ typedef struct SQueryAttr {
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// TODO used bitwise flag
bool
uniqueQuery
;
bool
tailQuery
;
bool
groupbyColumn
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
bool
timeWindowInterpo
;
// if the time window start/end required interpolation
...
...
@@ -736,5 +735,4 @@ void addTableReadRows(SQueryRuntimeEnv* pEnv, int32_t tid, int32_t rows);
bool
qReadOverCB
(
void
*
param
,
int8_t
type
,
int32_t
tid
);
bool
isUniqueQuery
(
int32_t
numOfOutput
,
SExprInfo
*
pExprs
);
bool
isTailQuery
(
int32_t
numOfOutput
,
SExprInfo
*
pExprs
);
#endif // TDENGINE_QEXECUTOR_H
src/query/src/qExecutor.c
浏览文件 @
36837467
...
...
@@ -47,11 +47,6 @@
#define MULTI_KEY_DELIM "-"
#define TIME_WINDOW_COPY(_dst, _src) do {\
(_dst).skey = (_src).skey;\
(_dst).ekey = (_src).ekey;\
} while (0)
enum
{
TS_JOIN_TS_EQUAL
=
0
,
TS_JOIN_TS_NOT_EQUALS
=
1
,
...
...
@@ -2607,7 +2602,7 @@ static bool onlyOneQueryType(SQueryAttr *pQueryAttr, int32_t functId, int32_t fu
static
bool
onlyFirstQuery
(
SQueryAttr
*
pQueryAttr
)
{
return
onlyOneQueryType
(
pQueryAttr
,
TSDB_FUNC_FIRST
,
TSDB_FUNC_FIRST_DST
);
}
static
bool
onlyLastQuery
(
SQueryAttr
*
pQueryAttr
)
{
return
onlyOneQueryType
(
pQueryAttr
,
TSDB_FUNC_LAST
,
TSDB_FUNC_LAST_DST
);
}
static
bool
onlyLastQuery
(
SQueryAttr
*
pQueryAttr
)
{
return
onlyOneQueryType
(
pQueryAttr
,
TSDB_FUNC_LAST
,
TSDB_FUNC_LAST_DST
)
||
onlyOneQueryType
(
pQueryAttr
,
TSDB_FUNC_TAIL
,
TSDB_FUNC_TAIL
)
;
}
static
bool
notContainSessionOrStateWindow
(
SQueryAttr
*
pQueryAttr
)
{
return
!
(
pQueryAttr
->
sw
.
gap
>
0
||
pQueryAttr
->
stateWindow
);
}
...
...
@@ -3955,15 +3950,6 @@ bool isUniqueQuery(int32_t numOfOutput, SExprInfo* pExprs) {
return
false
;
}
bool
isTailQuery
(
int32_t
numOfOutput
,
SExprInfo
*
pExprs
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
if
(
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TAIL
)
{
return
true
;
}
}
return
false
;
}
static
bool
hasMainOutput
(
SQueryAttr
*
pQueryAttr
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfOutput
;
++
i
)
{
int32_t
functionId
=
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
;
...
...
@@ -5115,18 +5101,13 @@ STsdbQueryCond createTsdbQueryCond(SQueryAttr* pQueryAttr, STimeWindow* win) {
.
numOfCols
=
pQueryAttr
->
numOfCols
,
.
type
=
BLOCK_LOAD_OFFSET_SEQ_ORDER
,
.
loadExternalRows
=
false
,
.
twindow
=
*
win
,
};
// set offset with
if
(
pQueryAttr
->
skipOffset
)
{
cond
.
offset
=
pQueryAttr
->
limit
.
offset
;
}
if
(
pQueryAttr
->
tailQuery
)
{
cond
.
order
=
TSDB_ORDER_DESC
;
}
TIME_WINDOW_COPY
(
cond
.
twindow
,
*
win
);
return
cond
;
}
...
...
@@ -9607,7 +9588,6 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S
pQueryAttr
->
pFilters
=
pFilters
;
pQueryAttr
->
range
=
pQueryMsg
->
range
;
pQueryAttr
->
uniqueQuery
=
isUniqueQuery
(
numOfOutput
,
pExprs
);
pQueryAttr
->
tailQuery
=
isTailQuery
(
numOfOutput
,
pExprs
);
pQueryAttr
->
tableCols
=
calloc
(
numOfCols
,
sizeof
(
SSingleColumnFilterInfo
));
if
(
pQueryAttr
->
tableCols
==
NULL
)
{
...
...
src/query/src/qUtil.c
浏览文件 @
36837467
...
...
@@ -38,7 +38,8 @@ int32_t getRowNumForMultioutput(SQueryAttr* pQueryAttr, bool topBottomQuery, boo
if
(
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_TOP
||
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_BOTTOM
||
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_SAMPLE
||
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_HISTOGRAM
)
{
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_HISTOGRAM
||
pQueryAttr
->
pExpr1
[
i
].
base
.
functionId
==
TSDB_FUNC_TAIL
)
{
return
(
int32_t
)
pQueryAttr
->
pExpr1
[
i
].
base
.
param
[
0
].
i64
;
}
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
36837467
...
...
@@ -1855,11 +1855,12 @@ static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
while
(
i
<
numOfCols
&&
(
j
<
numOfColsOfRow1
||
k
<
numOfColsOfRow2
))
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
pData
=
(
char
*
)
pColInfo
->
pData
+
numOfRows
*
pColInfo
->
info
.
bytes
;
}
else
{
pData
=
(
char
*
)
pColInfo
->
pData
+
(
capacity
-
numOfRows
-
1
)
*
pColInfo
->
info
.
bytes
;
}
pData
=
(
char
*
)
pColInfo
->
pData
+
numOfRows
*
pColInfo
->
info
.
bytes
;
// if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
// } else {
// pData = (char*)pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes;
// }
int32_t
colIdOfRow1
;
if
(
j
>=
numOfColsOfRow1
)
{
...
...
@@ -1990,11 +1991,12 @@ static void mergeTwoRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
if
(
forceSetNull
)
{
while
(
i
<
numOfCols
)
{
// the remain columns are all null data
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
if
(
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
{
pData
=
(
char
*
)
pColInfo
->
pData
+
numOfRows
*
pColInfo
->
info
.
bytes
;
}
else
{
pData
=
(
char
*
)
pColInfo
->
pData
+
(
capacity
-
numOfRows
-
1
)
*
pColInfo
->
info
.
bytes
;
}
pData
=
(
char
*
)
pColInfo
->
pData
+
numOfRows
*
pColInfo
->
info
.
bytes
;
// if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
// } else {
// pData = (char*)pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes;
// }
if
(
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_BINARY
||
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
setVardataNull
(
pData
,
pColInfo
->
info
.
type
);
...
...
@@ -2340,7 +2342,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
SWAP
(
cur
->
win
.
skey
,
cur
->
win
.
ekey
,
TSKEY
);
}
moveDataToFront
(
pQueryHandle
,
numOfRows
,
numOfCols
);
//
moveDataToFront(pQueryHandle, numOfRows, numOfCols);
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
...
...
@@ -2978,14 +2980,14 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
assert
(
numOfRows
<=
maxRowsToRead
);
// if the buffer is not full in case of descending order query, move the data in the front of the buffer
if
(
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
&&
numOfRows
<
maxRowsToRead
)
{
int32_t
emptySize
=
maxRowsToRead
-
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
memmove
((
char
*
)
pColInfo
->
pData
,
(
char
*
)
pColInfo
->
pData
+
emptySize
*
pColInfo
->
info
.
bytes
,
numOfRows
*
pColInfo
->
info
.
bytes
);
}
}
//
if (!ASCENDING_TRAVERSE(pQueryHandle->order) && numOfRows < maxRowsToRead) {
//
int32_t emptySize = maxRowsToRead - numOfRows;
//
//
for(int32_t i = 0; i < numOfCols; ++i) {
//
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
//
memmove((char*)pColInfo->pData, (char*)pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes);
//
}
//
}
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d, 0x%"
PRIx64
,
pQueryHandle
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录