You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/03 13:36:12 UTC
[GitHub] [incubator-inlong] healchow commented on a change in pull request #2879: [INLONG-2856][Manager] Support multi-source and multi-sink in one stream
healchow commented on a change in pull request #2879:
URL: https://github.com/apache/incubator-inlong/pull/2879#discussion_r818661045
##########
File path: inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/source/StreamSourceServiceImpl.java
##########
@@ -127,30 +126,22 @@ public Integer getCount(String groupId, String streamId) {
Preconditions.checkNotNull(request.getInlongGroupId(), Constant.GROUP_ID_IS_EMPTY);
PageHelper.startPage(request.getPageNum(), request.getPageSize());
- Page<StreamSourceEntity> entityPage = (Page<StreamSourceEntity>) sourceMapper.selectByCondition(request);
+ List<StreamSourceEntity> entityPage = sourceMapper.selectByCondition(request);
// Encapsulate the paging query results into the PageInfo object to obtain related paging information
- List<SourceListResponse> responses = Lists.newArrayList();
- for (StreamSourceEntity entity : entityPage) {
- SourceType sourceType = SourceType.forType(entity.getSourceType());
+ Map<SourceType, Page<StreamSourceEntity>> sourceMap = Maps.newHashMap();
+ for (StreamSourceEntity streamSource : entityPage) {
+ SourceType sourceType = SourceType.forType(streamSource.getSourceType());
+ sourceMap.computeIfAbsent(sourceType, k -> new Page<>()).add(streamSource);
+ }
+ List<SourceListResponse> sourceListResponses = Lists.newArrayList();
+ for (Map.Entry<SourceType, Page<StreamSourceEntity>> entry : sourceMap.entrySet()) {
+ SourceType sourceType = entry.getKey();
Review comment:
Great!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org