This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 294882f [Improvement-8218][dolphinscheduler-api]
QueryTaskInstanceListPaging API performance improvement (#8223)
294882f is described below
commit 294882f5d72598283438c8bdc4297d018f59e5a7
Author: ouyangyewei <[email protected]>
AuthorDate: Wed Feb 9 12:58:15 2022 +0800
[Improvement-8218][dolphinscheduler-api] QueryTaskInstanceListPaging API
performance improvement (#8223)
---
.../dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java | 5 +++--
.../org/apache/dolphinscheduler/common/utils/CollectionUtils.java | 5 +----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
index ab53c58..e25cde6 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java
@@ -143,8 +143,9 @@ public class TaskInstanceServiceImpl extends
BaseServiceImpl implements TaskInst
Map<Integer, User> userMap =
users.stream().collect(Collectors.toMap(User::getId, v -> v));
for (TaskInstance taskInstance : taskInstanceList) {
taskInstance.setDuration(DateUtils.format2Duration(taskInstance.getStartTime(),
taskInstance.getEndTime()));
- if (userMap.containsKey(taskInstance.getExecutorId())) {
-
taskInstance.setExecutorName(userMap.get(taskInstance.getExecutorId()).getUserName());
+ User user = userMap.get(taskInstance.getExecutorId());
+ if (user != null) {
+ taskInstance.setExecutorName(user.getUserName());
}
}
pageInfo.setTotal((int) taskInstanceIPage.getTotal());
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
index 295fb77..a48ed1f 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
@@ -78,9 +78,6 @@ public class CollectionUtils {
*/
public static <T extends Object> List<Map<String, Object>>
getListByExclusion(List<T> originList, Set<String> exclusionSet) {
List<Map<String, Object>> instanceList = new ArrayList<>();
- if (exclusionSet == null) {
- exclusionSet = new HashSet<>();
- }
if (originList == null) {
return instanceList;
}
@@ -89,7 +86,7 @@ public class CollectionUtils {
BeanMap beanMap = new BeanMap(instance);
instanceMap = new LinkedHashMap<>(16, 0.75f, true);
for (Map.Entry<Object, Object> entry : beanMap.entrySet()) {
- if (exclusionSet.contains(entry.getKey())) {
+ if (exclusionSet != null &&
exclusionSet.contains(entry.getKey())) {
continue;
}
instanceMap.put((String) entry.getKey(), entry.getValue());