Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f2c6f31
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0f2c6f31
编写于
10月 22, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1373]
上级
05696725
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
20 deletion
+54
-20
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+2
-2
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+3
-3
src/query/inc/qTsbuf.h
src/query/inc/qTsbuf.h
+4
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-2
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+39
-13
未找到文件。
src/client/src/tscFunctionImpl.c
浏览文件 @
0f2c6f31
...
...
@@ -4025,11 +4025,11 @@ static void ts_comp_function(SQLFunctionCtx *pCtx) {
// primary ts must be existed, so no need to check its existance
if
(
pCtx
->
order
==
TSDB_ORDER_ASC
)
{
tsBufAppend
(
pTSbuf
,
0
,
&
pCtx
->
tag
,
input
,
pCtx
->
size
*
TSDB_KEYSIZE
);
tsBufAppend
(
pTSbuf
,
pCtx
->
param
[
0
].
i64Key
,
&
pCtx
->
tag
,
input
,
pCtx
->
size
*
TSDB_KEYSIZE
);
}
else
{
for
(
int32_t
i
=
pCtx
->
size
-
1
;
i
>=
0
;
--
i
)
{
char
*
d
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
i
);
tsBufAppend
(
pTSbuf
,
0
,
&
pCtx
->
tag
,
d
,
TSDB_KEYSIZE
);
tsBufAppend
(
pTSbuf
,
pCtx
->
param
[
0
].
i64Key
,
&
pCtx
->
tag
,
d
,
TSDB_KEYSIZE
);
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
0f2c6f31
...
...
@@ -158,9 +158,9 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ
tsBufDestroy
(
pSupporter1
->
pTSBuf
);
tsBufDestroy
(
pSupporter2
->
pTSBuf
);
tscDebug
(
"%p input1:%"
PRId64
", input2:%"
PRId64
", final:%"
PRId64
" for secondary query after ts blocks "
"intersecting, skey:%"
PRId64
", ekey:%"
PRId64
,
pSql
,
numOfInput1
,
numOfInput2
,
output1
->
numOfTotal
,
win
->
skey
,
win
->
ekey
);
tscDebug
(
"%p input1:%"
PRId64
", input2:%"
PRId64
", final:%"
PRId64
"
in %d vnodes
for secondary query after ts blocks "
"intersecting, skey:%"
PRId64
", ekey:%"
PRId64
", numOfVnode:%d"
,
pSql
,
numOfInput1
,
numOfInput2
,
output1
->
numOfTotal
,
output1
->
numOfVnodes
,
win
->
skey
,
win
->
ekey
,
tsBufGetNumOfVnodes
(
output1
)
);
return
output1
->
numOfTotal
;
}
...
...
src/query/inc/qTsbuf.h
浏览文件 @
0f2c6f31
...
...
@@ -136,6 +136,10 @@ void tsBufSetCursor(STSBuf* pTSBuf, STSCursor* pCur);
*/
void
tsBufDisplay
(
STSBuf
*
pTSBuf
);
int32_t
tsBufGetNumOfVnodes
(
STSBuf
*
pTSBuf
);
void
tsBufGetVnodeIdList
(
STSBuf
*
pTSBuf
,
int32_t
*
num
,
int32_t
**
vnodeId
);
#ifdef __cplusplus
}
#endif
...
...
src/query/src/qExecutor.c
浏览文件 @
0f2c6f31
...
...
@@ -1005,9 +1005,10 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *
longjmp
(
pRuntimeEnv
->
env
,
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
SQInfo
*
pQInfo
=
GET_QINFO_ADDR
(
pQuery
);
for
(
int32_t
k
=
0
;
k
<
pQuery
->
numOfOutput
;
++
k
)
{
char
*
dataBlock
=
getDataBlock
(
pRuntimeEnv
,
&
sasArray
[
k
],
k
,
pDataBlockInfo
->
rows
,
pDataBlock
);
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
tsCols
,
pDataBlockInfo
,
pStatis
,
&
sasArray
[
k
],
k
);
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
tsCols
,
pDataBlockInfo
,
pStatis
,
&
sasArray
[
k
],
k
,
pQInfo
->
vgId
);
}
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
...
...
@@ -1469,7 +1470,7 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl
}
void
setExecParams
(
SQuery
*
pQuery
,
SQLFunctionCtx
*
pCtx
,
void
*
inputData
,
TSKEY
*
tsCol
,
SDataBlockInfo
*
pBlockInfo
,
SDataStatis
*
pStatis
,
void
*
param
,
int32_t
colIndex
)
{
SDataStatis
*
pStatis
,
void
*
param
,
int32_t
colIndex
,
int32_t
vgId
)
{
int32_t
functionId
=
pQuery
->
pSelectExpr
[
colIndex
].
base
.
functionId
;
int32_t
colId
=
pQuery
->
pSelectExpr
[
colIndex
].
base
.
colInfo
.
colId
;
...
...
@@ -1542,6 +1543,9 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY
}
}
}
}
else
if
(
functionId
==
TSDB_FUNC_TS_COMP
)
{
pCtx
->
param
[
0
].
i64Key
=
vgId
;
pCtx
->
param
[
0
].
nType
=
TSDB_DATA_TYPE_BIGINT
;
}
#if defined(_DEBUG_VIEW)
...
...
src/query/src/qTsbuf.c
浏览文件 @
0f2c6f31
...
...
@@ -561,6 +561,19 @@ static void tsBufGetBlock(STSBuf* pTSBuf, int32_t vnodeIndex, int32_t blockIndex
pCur
->
tsIndex
=
(
pCur
->
order
==
TSDB_ORDER_ASC
)
?
0
:
pBlock
->
numOfElem
-
1
;
}
static
int32_t
doUpdateVnodeInfo
(
STSBuf
*
pTSBuf
,
int64_t
offset
,
STSVnodeBlockInfo
*
pVInfo
)
{
if
(
offset
<
0
||
offset
>=
getDataStartOffset
())
{
return
-
1
;
}
if
(
fseek
(
pTSBuf
->
f
,
(
int32_t
)
offset
,
SEEK_SET
)
!=
0
)
{
return
-
1
;
}
fwrite
(
pVInfo
,
sizeof
(
STSVnodeBlockInfo
),
1
,
pTSBuf
->
f
);
return
0
;
}
STSVnodeBlockInfo
*
tsBufGetVnodeBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
vnodeId
)
{
int32_t
j
=
tsBufFindVnodeIndexFromId
(
pTSBuf
->
pData
,
pTSBuf
->
numOfVnodes
,
vnodeId
);
if
(
j
==
-
1
)
{
...
...
@@ -915,19 +928,6 @@ static int32_t getDataStartOffset() {
return
sizeof
(
STSBufFileHeader
)
+
TS_COMP_FILE_VNODE_MAX
*
sizeof
(
STSVnodeBlockInfo
);
}
static
int32_t
doUpdateVnodeInfo
(
STSBuf
*
pTSBuf
,
int64_t
offset
,
STSVnodeBlockInfo
*
pVInfo
)
{
if
(
offset
<
0
||
offset
>=
getDataStartOffset
())
{
return
-
1
;
}
if
(
fseek
(
pTSBuf
->
f
,
(
int32_t
)
offset
,
SEEK_SET
)
!=
0
)
{
return
-
1
;
}
fwrite
(
pVInfo
,
sizeof
(
STSVnodeBlockInfo
),
1
,
pTSBuf
->
f
);
return
0
;
}
// update prev vnode length info in file
static
void
TSBufUpdateVnodeInfo
(
STSBuf
*
pTSBuf
,
int32_t
index
,
STSVnodeBlockInfo
*
pBlockInfo
)
{
int32_t
offset
=
sizeof
(
STSBufFileHeader
)
+
index
*
sizeof
(
STSVnodeBlockInfo
);
...
...
@@ -969,3 +969,29 @@ static STSBuf* allocResForTSBuf(STSBuf* pTSBuf) {
pTSBuf
->
fileSize
+=
getDataStartOffset
();
return
pTSBuf
;
}
int32_t
tsBufGetNumOfVnodes
(
STSBuf
*
pTSBuf
)
{
if
(
pTSBuf
==
NULL
)
{
return
0
;
}
return
pTSBuf
->
pData
->
len
;
}
void
tsBufGetVnodeIdList
(
STSBuf
*
pTSBuf
,
int32_t
*
num
,
int32_t
**
vnodeId
)
{
int32_t
size
=
tsBugGetNumOfVnodes
(
pTSBuf
);
if
(
num
!=
NULL
)
{
*
num
=
size
;
}
*
vnodeId
=
NULL
;
if
(
size
==
0
)
{
return
;
}
(
*
vnodeId
)
=
malloc
(
tsBugGetNumOfVnodes
(
pTSBuf
)
*
sizeof
(
int32_t
));
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
(
*
vnodeId
)[
i
]
=
pTSBuf
->
pData
[
i
].
info
.
vnode
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录