Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e8a1c539
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
e8a1c539
编写于
2月 27, 2023
作者:
W
wade zhang
提交者:
GitHub
2月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20171 from taosdata/fix/join_bug
fix(query): fix join_bug.
上级
584af372
c4a53438
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
27 deletion
+40
-27
src/client/src/tscServer.c
src/client/src/tscServer.c
+9
-4
src/query/inc/qTsbuf.h
src/query/inc/qTsbuf.h
+1
-1
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+30
-22
未找到文件。
src/client/src/tscServer.c
浏览文件 @
e8a1c539
...
...
@@ -1253,8 +1253,15 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
pQueryInfo
->
tsBuf
!=
NULL
)
{
// note: here used the idx instead of actual vnode id.
int32_t
vnodeIndex
=
pTableMetaInfo
->
vgroupIndex
;
code
=
dumpFileBlockByGroupId
(
pQueryInfo
->
tsBuf
,
vnodeIndex
,
pMsg
,
&
pQueryMsg
->
tsBuf
.
tsLen
,
&
pQueryMsg
->
tsBuf
.
tsNumOfBlocks
);
int32_t
vgId
=
0
;
if
(
pTableMetaInfo
->
vgroupList
!=
NULL
)
{
int32_t
vnodeIndex
=
pTableMetaInfo
->
vgroupIndex
;
vgId
=
pTableMetaInfo
->
vgroupList
->
vgroups
[
vnodeIndex
].
vgId
;
}
else
{
vgId
=
query
.
vgId
;
}
code
=
dumpFileBlockByGroupId
(
pQueryInfo
->
tsBuf
,
vgId
,
pMsg
,
&
pQueryMsg
->
tsBuf
.
tsLen
,
&
pQueryMsg
->
tsBuf
.
tsNumOfBlocks
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_end
;
}
...
...
@@ -1317,8 +1324,6 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
memcpy
(
pMsg
,
pSql
->
sqlstr
,
sqlLen
);
pMsg
+=
sqlLen
;
pQueryMsg
->
extend
=
1
;
STLV
*
tlv
=
(
STLV
*
)
pMsg
;
...
...
src/query/inc/qTsbuf.h
浏览文件 @
e8a1c539
...
...
@@ -110,7 +110,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf);
STSBuf
*
tsBufClone
(
STSBuf
*
pTSBuf
);
S
TSGroupBlockInfo
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
id
);
S
Array
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
id
);
void
tsBufFlush
(
STSBuf
*
pTSBuf
);
void
tsBufResetPos
(
STSBuf
*
pTSBuf
);
...
...
src/query/src/qTsbuf.c
浏览文件 @
e8a1c539
...
...
@@ -651,13 +651,16 @@ static int32_t doUpdateGroupInfo(STSBuf* pTSBuf, int64_t offset, STSGroupBlockIn
return
0
;
}
STSGroupBlockInfo
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
id
)
{
int32_t
j
=
tsBufFindGroupById
(
pTSBuf
->
pData
,
pTSBuf
->
numOfGroups
,
id
);
if
(
j
==
-
1
)
{
return
NULL
;
SArray
*
tsBufGetGroupBlockInfo
(
STSBuf
*
pTSBuf
,
int32_t
id
)
{
SArray
*
pList
=
taosArrayInit
(
4
,
sizeof
(
STSGroupBlockInfo
));
for
(
int32_t
i
=
0
;
i
<
pTSBuf
->
numOfGroups
;
++
i
)
{
if
(
pTSBuf
->
pData
[
i
].
info
.
id
==
id
)
{
taosArrayPush
(
pList
,
&
pTSBuf
->
pData
[
i
].
info
);
}
}
return
&
pTSBuf
->
pData
[
j
].
info
;
return
pList
;
}
int32_t
STSBufUpdateHeader
(
STSBuf
*
pTSBuf
,
STSBufFileHeader
*
pHeader
)
{
...
...
@@ -1099,28 +1102,33 @@ void tsBufGetGroupIdList(STSBuf* pTSBuf, int32_t* num, int32_t** id) {
}
}
int32_t
dumpFileBlockByGroupId
(
STSBuf
*
pTSBuf
,
int32_t
groupIndex
,
void
*
buf
,
int32_t
*
len
,
int32_t
*
numOfBlocks
)
{
assert
(
groupIndex
>=
0
&&
groupIndex
<
pTSBuf
->
numOfGroups
);
STSGroupBlockInfo
*
pBlockInfo
=
&
pTSBuf
->
pData
[
groupIndex
].
info
;
int32_t
dumpFileBlockByGroupId
(
STSBuf
*
pTSBuf
,
int32_t
groupId
,
void
*
buf
,
int32_t
*
len
,
int32_t
*
numOfBlocks
)
{
SArray
*
pList
=
tsBufGetGroupBlockInfo
(
pTSBuf
,
groupId
);
*
len
=
0
;
*
numOfBlocks
=
0
;
if
(
fseek
(
pTSBuf
->
f
,
pBlockInfo
->
offset
,
SEEK_SET
)
!=
0
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pTSBuf
->
f
));
// qError("%p: fseek failed: %s", pSql, tstrerror(code));
return
code
;
}
char
*
p
=
buf
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pList
);
++
i
)
{
STSGroupBlockInfo
*
pBlockInfo
=
taosArrayGet
(
pList
,
i
);
size_t
s
=
fread
(
buf
,
1
,
pBlockInfo
->
compLen
,
pTSBuf
->
f
);
if
(
s
!=
pBlockInfo
->
compLen
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pTSBuf
->
f
));
// tscError("%p: fread didn't return expected data: %s", pSql, tstrerror(code));
return
code
;
}
if
(
fseek
(
pTSBuf
->
f
,
pBlockInfo
->
offset
,
SEEK_SET
)
!=
0
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pTSBuf
->
f
));
// qError("%p: fseek failed: %s", pSql, tstrerror(code));
return
code
;
}
*
len
=
pBlockInfo
->
compLen
;
*
numOfBlocks
=
pBlockInfo
->
numOfBlocks
;
size_t
s
=
fread
(
p
,
1
,
pBlockInfo
->
compLen
,
pTSBuf
->
f
);
if
(
s
!=
pBlockInfo
->
compLen
)
{
int
code
=
TAOS_SYSTEM_ERROR
(
ferror
(
pTSBuf
->
f
));
// tscError("%p: fread didn't return expected data: %s", pSql, tstrerror(code));
return
code
;
}
*
len
+=
pBlockInfo
->
compLen
;
*
numOfBlocks
+=
pBlockInfo
->
numOfBlocks
;
p
+=
pBlockInfo
->
compLen
;
}
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录