mirror of https://github.com/apache/druid.git
Retain order in TaskReport. (#12005)
This commit is contained in:
parent
61e1ffc7f7
commit
ada3ae08df
|
@ -22,7 +22,7 @@ package org.apache.druid.indexing.common;
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,9 +44,13 @@ public interface TaskReport
|
||||||
*/
|
*/
|
||||||
Object getPayload();
|
Object getPayload();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an order-preserving map that is suitable for passing into {@link TaskReportFileWriter#write}.
|
||||||
|
*/
|
||||||
static Map<String, TaskReport> buildTaskReports(TaskReport... taskReports)
|
static Map<String, TaskReport> buildTaskReports(TaskReport... taskReports)
|
||||||
{
|
{
|
||||||
Map<String, TaskReport> taskReportMap = new HashMap<>();
|
// Use LinkedHashMap to preserve order of the reports.
|
||||||
|
Map<String, TaskReport> taskReportMap = new LinkedHashMap<>();
|
||||||
for (TaskReport taskReport : taskReports) {
|
for (TaskReport taskReport : taskReports) {
|
||||||
taskReportMap.put(taskReport.getReportKey(), taskReport);
|
taskReportMap.put(taskReport.getReportKey(), taskReport);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue