Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-45291][SQL][REST] Use unknown query execution id instead of no such app when id is invalid #43073

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ private[v1] class SqlResource extends BaseAppResource {
planDescription: Boolean): ExecutionData = {
withUI { ui =>
val sqlStore = new SQLAppStatusStore(ui.store.store)
val graph = sqlStore.planGraph(execId)
sqlStore
.execution(execId)
.map(prepareExecutionData(_, graph, details, planDescription))
.map(prepareExecutionData(_, sqlStore.planGraph(execId), details, planDescription))
.getOrElse(throw new NotFoundException("unknown query execution id: " + execId))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.spark.status.api.v1.sql

import java.net.URL
import java.text.SimpleDateFormat
import javax.servlet.http.HttpServletResponse

import org.json4s.DefaultFormats
import org.json4s.jackson.JsonMethods
Expand Down Expand Up @@ -148,4 +149,12 @@ class SqlResourceWithActualMetricsSuite
}
}

test("SPARK-45291: Use unknown query execution id instead of no such app when id is invalid") {
val url = new URL(spark.sparkContext.ui.get.webUrl +
s"/api/v1/applications/${spark.sparkContext.applicationId}/sql/${Long.MaxValue}")
val (code, resultOpt, error) = getContentAndCode(url)
assert(code === HttpServletResponse.SC_NOT_FOUND)
assert(resultOpt.isEmpty)
assert(error.get === s"unknown query execution id: ${Long.MaxValue}")
}
}