Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2eb496e9
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看板
未验证
提交
2eb496e9
编写于
12月 06, 2022
作者:
D
dapan1121
提交者:
GitHub
12月 06, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18741 from taosdata/fix/TD-20929
fix:read data and compute group id
上级
a6d540f2
99975ae5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
38 addition
and
16 deletion
+38
-16
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+38
-16
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
2eb496e9
...
@@ -1218,27 +1218,56 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
...
@@ -1218,27 +1218,56 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
if
(
rows
==
0
)
{
if
(
rows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
code
=
blockDataEnsureCapacity
(
pDestBlock
,
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
SColumnInfoData
*
pSrcStartTsCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pSrcStartTsCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pSrcEndTsCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pSrcEndTsCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pSrcUidCol
=
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
UID_COLUMN_INDEX
);
SColumnInfoData
*
pSrcUidCol
=
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
UID_COLUMN_INDEX
);
uint64_t
*
srcUidData
=
(
uint64_t
*
)
pSrcUidCol
->
pData
;
SColumnInfoData
*
pSrcGpCol
=
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pSrcGpCol
=
taosArrayGet
(
pSrcBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
uint64_t
*
srcGp
=
(
uint64_t
*
)
pSrcGpCol
->
pData
;
uint64_t
*
srcUidData
=
(
uint64_t
*
)
pSrcUidCol
->
pData
;
ASSERT
(
pSrcStartTsCol
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
ASSERT
(
pSrcStartTsCol
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
TSKEY
*
srcStartTsCol
=
(
TSKEY
*
)
pSrcStartTsCol
->
pData
;
TSKEY
*
srcStartTsCol
=
(
TSKEY
*
)
pSrcStartTsCol
->
pData
;
TSKEY
*
srcEndTsCol
=
(
TSKEY
*
)
pSrcEndTsCol
->
pData
;
TSKEY
*
srcEndTsCol
=
(
TSKEY
*
)
pSrcEndTsCol
->
pData
;
int64_t
version
=
pSrcBlock
->
info
.
version
-
1
;
if
(
pInfo
->
partitionSup
.
needCalc
&&
srcStartTsCol
[
0
]
!=
srcEndTsCol
[
0
])
{
uint64_t
srcUid
=
srcUidData
[
0
];
TSKEY
startTs
=
srcStartTsCol
[
0
];
TSKEY
endTs
=
srcEndTsCol
[
0
];
SSDataBlock
*
pPreRes
=
readPreVersionData
(
pInfo
->
pTableScanOp
,
srcUid
,
startTs
,
endTs
,
version
);
printDataBlock
(
pPreRes
,
"pre res"
);
blockDataCleanup
(
pSrcBlock
);
int32_t
code
=
blockDataEnsureCapacity
(
pSrcBlock
,
pPreRes
->
info
.
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
SColumnInfoData
*
pTsCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pPreRes
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
rows
=
pPreRes
->
info
.
rows
;
for
(
int32_t
i
=
0
;
i
<
rows
;
i
++
)
{
uint64_t
groupId
=
calGroupIdByData
(
&
pInfo
->
partitionSup
,
pInfo
->
pPartScalarSup
,
pPreRes
,
i
);
appendOneRowToStreamSpecialBlock
(
pSrcBlock
,
((
TSKEY
*
)
pTsCol
->
pData
)
+
i
,
((
TSKEY
*
)
pTsCol
->
pData
)
+
i
,
&
srcUid
,
&
groupId
,
NULL
);
}
printDataBlock
(
pSrcBlock
,
"new delete"
);
}
uint64_t
*
srcGp
=
(
uint64_t
*
)
pSrcGpCol
->
pData
;
srcStartTsCol
=
(
TSKEY
*
)
pSrcStartTsCol
->
pData
;
srcEndTsCol
=
(
TSKEY
*
)
pSrcEndTsCol
->
pData
;
srcUidData
=
(
uint64_t
*
)
pSrcUidCol
->
pData
;
int32_t
code
=
blockDataEnsureCapacity
(
pDestBlock
,
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
SColumnInfoData
*
pStartTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pStartTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pDeUidCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
UID_COLUMN_INDEX
);
SColumnInfoData
*
pDeUidCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
UID_COLUMN_INDEX
);
SColumnInfoData
*
pGpCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pGpCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalStartTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
CALCULATE_START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pCalEndTsCol
=
taosArrayGet
(
pDestBlock
->
pDataBlock
,
CALCULATE_END_TS_COLUMN_INDEX
);
int64_t
version
=
pSrcBlock
->
info
.
version
-
1
;
for
(
int32_t
i
=
0
;
i
<
rows
;)
{
for
(
int32_t
i
=
0
;
i
<
rows
;)
{
uint64_t
srcUid
=
srcUidData
[
i
];
uint64_t
srcUid
=
srcUidData
[
i
];
uint64_t
groupId
=
srcGp
[
i
];
uint64_t
groupId
=
srcGp
[
i
];
...
@@ -1653,13 +1682,6 @@ static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
...
@@ -1653,13 +1682,6 @@ static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
uint64_t
groupId
=
getGroupIdByUid
(
pInfo
,
uidCol
[
i
]);
uint64_t
groupId
=
getGroupIdByUid
(
pInfo
,
uidCol
[
i
]);
colDataAppend
(
pGpCol
,
i
,
(
const
char
*
)
&
groupId
,
false
);
colDataAppend
(
pGpCol
,
i
,
(
const
char
*
)
&
groupId
,
false
);
}
}
}
else
{
// SSDataBlock* pPreRes = readPreVersionData(pInfo->pTableScanOp, uidCol[i], startTsCol, ts, maxVersion);
// if (!pPreRes || pPreRes->info.rows == 0) {
// return 0;
// }
// ASSERT(pPreRes->info.rows == 1);
// return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录