From afa0c9648dd790042ffa8792eef327656ae9694d Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Sat, 27 Jul 2024 01:43:39 +0530 Subject: [PATCH] Attempt to fix web console check --- .../msq/sql/resources/SqlStatementResource.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java index 7575dd00dcb8..98a6e207b432 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java @@ -587,9 +587,9 @@ private Optional getStatementStatus( MSQControllerTask msqControllerTask = getMSQControllerTaskAndCheckPermission(queryId, authenticationResult, forAction); SqlStatementState sqlStatementState = SqlStatementResourceHelper.getSqlStatementState(statusPlus); - MSQTaskReportPayload msqTaskReportPayload = null; + Optional msqTaskReportPayload = Optional.empty(); try { - msqTaskReportPayload = SqlStatementResourceHelper.getPayload(contactOverlord(overlordClient.taskReportAsMap(queryId), queryId)); + msqTaskReportPayload = Optional.ofNullable(SqlStatementResourceHelper.getPayload(contactOverlord(overlordClient.taskReportAsMap(queryId), queryId))); } catch (DruidException e) { if (!e.getErrorCode().equals("notFound")) { @@ -603,7 +603,7 @@ private Optional getStatementStatus( taskResponse, statusPlus, sqlStatementState, - msqTaskReportPayload, + msqTaskReportPayload.orElse(null), jsonMapper, detail ); @@ -622,9 +622,9 @@ private Optional getStatementStatus( msqControllerTask.getQuerySpec().getDestination() ).orElse(null) : null, null, - detail ? SqlStatementResourceHelper.getQueryStagesReport(msqTaskReportPayload) : null, - detail ? SqlStatementResourceHelper.getQueryCounters(msqTaskReportPayload) : null, - detail ? SqlStatementResourceHelper.getQueryWarningDetails(msqTaskReportPayload) : null + detail ? SqlStatementResourceHelper.getQueryStagesReport(msqTaskReportPayload.orElse(null)) : null, + detail ? SqlStatementResourceHelper.getQueryCounters(msqTaskReportPayload.orElse(null)) : null, + detail ? SqlStatementResourceHelper.getQueryWarningDetails(msqTaskReportPayload.orElse(null)) : null )); } }