kfaraz commented on code in PR #16217: URL: https://github.com/apache/druid/pull/16217#discussion_r1545932328
########## indexing-service/src/main/java/org/apache/druid/indexing/common/TaskReport.java: ########## @@ -48,13 +51,29 @@ public interface TaskReport /** * Returns an order-preserving map that is suitable for passing into {@link TaskReportFileWriter#write}. */ - static Map<String, TaskReport> buildTaskReports(TaskReport... taskReports) + static ReportMap buildTaskReports(TaskReport... taskReports) { - // Use LinkedHashMap to preserve order of the reports. - Map<String, TaskReport> taskReportMap = new LinkedHashMap<>(); + ReportMap taskReportMap = new ReportMap(); for (TaskReport taskReport : taskReports) { taskReportMap.put(taskReport.getReportKey(), taskReport); } return taskReportMap; } + + /** + * Represents an ordered map from report key to a TaskReport that is compatible + * for writing out reports to files or serving over HTTP. + * <p> + * This class is needed for Jackson serde to work correctly. Without this class, + * a TaskReport is serialized without the type information and cannot be + * deserialized back into a concrete implementation. + */ + class ReportMap extends LinkedHashMap<String, TaskReport> Review Comment: No, I can add a test to verify the order. Although, I don't see any actual task writing a report map that contains multiple entries. Also not sure why the order was considered to be important in the first place, its json anyway. -- 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-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org