Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9031c50c
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看板
提交
9031c50c
编写于
8月 19, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1103] fix bugs
上级
2238b29f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
22 deletion
+41
-22
src/common/src/tvariant.c
src/common/src/tvariant.c
+11
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+2
-2
src/query/inc/tsqlfunction.h
src/query/inc/tsqlfunction.h
+5
-5
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+15
-7
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+7
-6
未找到文件。
src/common/src/tvariant.c
浏览文件 @
9031c50c
...
...
@@ -175,7 +175,17 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
}
int32_t
tVariantCompare
(
const
tVariant
*
p1
,
const
tVariant
*
p2
)
{
assert
((
p1
->
nType
!=
TSDB_DATA_TYPE_NULL
)
||
(
p2
->
nType
!=
TSDB_DATA_TYPE_NULL
));
if
(
p1
->
nType
==
TSDB_DATA_TYPE_NULL
&&
p2
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
return
0
;
}
if
(
p1
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
return
-
1
;
}
if
(
p2
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
return
1
;
}
switch
(
p1
->
nType
)
{
case
TSDB_DATA_TYPE_BINARY
:
...
...
src/query/inc/qExecutor.h
浏览文件 @
9031c50c
...
...
@@ -118,7 +118,7 @@ typedef struct SQueryCostInfo {
uint32_t
loadBlockStatis
;
uint32_t
discardBlocks
;
uint64_t
elapsedTime
;
uint64_t
comput
Time
;
uint64_t
firstStageMerge
Time
;
uint64_t
internalSupSize
;
uint64_t
numOfTimeWindows
;
}
SQueryCostInfo
;
...
...
src/query/inc/qUtil.h
浏览文件 @
9031c50c
...
...
@@ -38,8 +38,8 @@ static FORCE_INLINE SWindowResult *getWindowResult(SWindowResInfo *pWindowResInf
return
&
pWindowResInfo
->
pResult
[
slot
];
}
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define GET_TIMEWINDOW(_winresInfo, _win) (STimeWindow) {(_win)->skey, ((_win)->skey + (_winresInfo)->interval)}
#define curTimeWindowIndex(_winres)
((_winres)->curIndex)
#define GET_TIMEWINDOW(_winresInfo, _win) (STimeWindow) {(_win)->skey, ((_win)->skey + (_winresInfo)->interval
- 1
)}
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!sq))? (_q)->pSelectExpr[1].base.arg->argValue.i64:1)
bool
isWindowResClosed
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
...
...
src/query/inc/tsqlfunction.h
浏览文件 @
9031c50c
...
...
@@ -138,11 +138,11 @@ typedef struct SInterpInfoDetail {
typedef
struct
SResultInfo
{
int8_t
hasResult
;
// result generated, not NULL value
bool
initialized
:
1
;
// output buffer has been initialized
bool
complete
:
1
;
// query has completed
bool
superTableQ
:
1
;
// is super table query
int16_t
numOfRes
;
// num of output result in current buffer
uint
32_t
bufLen
;
// buffer size
bool
initialized
;
// output buffer has been initialized
bool
complete
;
// query has completed
bool
superTableQ
;
// is super table query
uint32_t
bufLen
;
// buffer size
uint
64_t
numOfRes
;
// num of output result in current buffer
void
*
interResultBuf
;
// output result buffer
}
SResultInfo
;
...
...
src/query/src/qExecutor.c
浏览文件 @
9031c50c
...
...
@@ -970,7 +970,6 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *
int32_t
index
=
pWindowResInfo
->
curIndex
;
STimeWindow
nextWin
=
win
;
assert
(
tsCols
!=
NULL
);
while
(
1
)
{
int32_t
prevEndPos
=
(
forwardStep
-
1
)
*
step
+
startPos
;
...
...
@@ -2668,7 +2667,7 @@ int32_t tableResultComparFn(const void *pLeft, const void *pRight, void *param)
}
int32_t
mergeIntoGroupResult
(
SQInfo
*
pQInfo
)
{
int64_t
st
=
taosGetTimestamp
M
s
();
int64_t
st
=
taosGetTimestamp
U
s
();
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
numOfGroups
=
(
int32_t
)(
GET_NUM_OF_TABLEGROUP
(
pQInfo
));
...
...
@@ -2695,9 +2694,11 @@ int32_t mergeIntoGroupResult(SQInfo *pQInfo) {
SET_STABLE_QUERY_OVER
(
pQInfo
);
}
qDebug
(
"QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%"
PRId64
"ms"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
,
numOfGroups
,
taosGetTimestampMs
()
-
st
);
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
qDebug
(
"QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%"
PRId64
"us"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
,
numOfGroups
,
elapsedTime
);
pQInfo
->
runtimeEnv
.
summary
.
firstStageMergeTime
+=
elapsedTime
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2830,6 +2831,13 @@ int32_t mergeIntoGroupResultImpl(SQInfo *pQInfo, SArray *pGroup) {
while
(
1
)
{
if
(
IS_QUERY_KILLED
(
pQInfo
))
{
qDebug
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
taosTFree
(
pTableList
);
taosTFree
(
posList
);
taosTFree
(
pTree
);
taosTFree
(
pResultInfo
);
taosTFree
(
buf
);
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_TSC_QUERY_CANCELLED
);
}
...
...
@@ -3996,9 +4004,9 @@ static void queryCostStatis(SQInfo *pQInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQueryCostInfo
*
pSummary
=
&
pRuntimeEnv
->
summary
;
qDebug
(
"QInfo:%p :cost summary: elapsed time:%"
PRId64
" us,
total blocks:%d, load block statis:%d,
"
" load data block:%d, total rows:%"
PRId64
", check rows:%"
PRId64
,
pQInfo
,
pSummary
->
elapsedTime
,
pSummary
->
totalBlocks
,
pSummary
->
loadBlockStatis
,
qDebug
(
"QInfo:%p :cost summary: elapsed time:%"
PRId64
" us,
first merge:%"
PRId64
" us, total blocks:%d,
"
"
load block statis:%d,
load data block:%d, total rows:%"
PRId64
", check rows:%"
PRId64
,
pQInfo
,
pSummary
->
elapsedTime
,
pSummary
->
firstStageMergeTime
,
pSummary
->
totalBlocks
,
pSummary
->
loadBlockStatis
,
pSummary
->
loadBlocks
,
pSummary
->
totalRows
,
pSummary
->
totalCheckedRows
);
qDebug
(
"QInfo:%p :cost summary: internal size:%"
PRId64
", numOfWin:%"
PRId64
,
pQInfo
,
pSummary
->
internalSupSize
,
...
...
src/query/src/qTsbuf.c
浏览文件 @
9031c50c
...
...
@@ -232,7 +232,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
TWO_STAGE_COMP
,
pTSBuf
->
assistBuf
,
pTSBuf
->
bufSize
);
int64_t
r
=
fseek
(
pTSBuf
->
f
,
pTSBuf
->
fileSize
,
SEEK_SET
);
UNUSED
(
r
);
assert
(
r
==
0
);
/*
* format for output data:
...
...
@@ -241,13 +241,14 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
*
* both side has the compressed length is used to support load data forwards/backwords.
*/
fwrite
(
&
pBlock
->
tag
.
nType
,
sizeof
(
pBlock
->
tag
.
nType
),
1
,
pTSBuf
->
f
);
fwrite
(
&
pBlock
->
tag
.
nLen
,
sizeof
(
pBlock
->
tag
.
nLen
),
1
,
pTSBuf
->
f
);
int32_t
metaLen
=
0
;
metaLen
+=
fwrite
(
&
pBlock
->
tag
.
nType
,
1
,
sizeof
(
pBlock
->
tag
.
nType
),
pTSBuf
->
f
);
metaLen
+=
fwrite
(
&
pBlock
->
tag
.
nLen
,
1
,
sizeof
(
pBlock
->
tag
.
nLen
),
pTSBuf
->
f
);
if
(
pBlock
->
tag
.
nType
==
TSDB_DATA_TYPE_BINARY
||
pBlock
->
tag
.
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
fwrite
(
pBlock
->
tag
.
pz
,
(
size_t
)
pBlock
->
tag
.
nLen
,
1
,
pTSBuf
->
f
);
metaLen
+=
fwrite
(
pBlock
->
tag
.
pz
,
1
,
(
size_t
)
pBlock
->
tag
.
nLen
,
pTSBuf
->
f
);
}
else
if
(
pBlock
->
tag
.
nType
!=
TSDB_DATA_TYPE_NULL
)
{
fwrite
(
&
pBlock
->
tag
.
i64Key
,
sizeof
(
int64_t
),
1
,
pTSBuf
->
f
);
metaLen
+=
fwrite
(
&
pBlock
->
tag
.
i64Key
,
1
,
sizeof
(
int64_t
)
,
pTSBuf
->
f
);
}
fwrite
(
&
pBlock
->
numOfElem
,
sizeof
(
pBlock
->
numOfElem
),
1
,
pTSBuf
->
f
);
...
...
@@ -255,7 +256,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) {
fwrite
(
pBlock
->
payload
,
(
size_t
)
pBlock
->
compLen
,
1
,
pTSBuf
->
f
);
fwrite
(
&
pBlock
->
compLen
,
sizeof
(
pBlock
->
compLen
),
1
,
pTSBuf
->
f
);
int32_t
blockSize
=
sizeof
(
pBlock
->
tag
)
+
sizeof
(
pBlock
->
numOfElem
)
+
sizeof
(
pBlock
->
compLen
)
*
2
+
pBlock
->
compLen
;
int32_t
blockSize
=
metaLen
+
sizeof
(
pBlock
->
numOfElem
)
+
sizeof
(
pBlock
->
compLen
)
*
2
+
pBlock
->
compLen
;
pTSBuf
->
fileSize
+=
blockSize
;
pTSBuf
->
tsData
.
len
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录