MCPcopy Create free account
hub / github.com/apache/impala / GetExecSummary

Method GetExecSummary

be/src/service/impala-server.cc:1053–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1051}
1052
1053Status ImpalaServer::GetExecSummary(const TUniqueId& query_id, const string& user,
1054 TExecSummary* result, TExecSummary* original_result, bool* was_retried) {
1055 if (was_retried != nullptr) *was_retried = false;
1056 // Search for the query id in the active query map.
1057 {
1058 // QueryHandle of the current query.
1059 QueryHandle query_handle;
1060 // QueryHandle or the original query if the query is retried.
1061 QueryHandle original_query_handle;
1062 Status status = GetAllQueryHandles(query_id, &query_handle, &original_query_handle,
1063 /*return_unregistered=*/ true);
1064 if (status.ok()) {
1065 lock_guard<mutex> l(*query_handle->lock());
1066 RETURN_IF_ERROR(CheckProfileAccess(user, query_handle->effective_user(),
1067 query_handle->user_has_profile_access()));
1068 if (query_handle->exec_state() == ClientRequestState::ExecState::PENDING) {
1069 const string* admission_result = query_handle->summary_profile()->GetInfoString(
1070 AdmissionController::PROFILE_INFO_KEY_ADMISSION_RESULT);
1071 if (admission_result != nullptr) {
1072 if (*admission_result == AdmissionController::PROFILE_INFO_VAL_QUEUED) {
1073 result->__set_is_queued(true);
1074 const string* queued_reason = query_handle->summary_profile()->GetInfoString(
1075 AdmissionController::PROFILE_INFO_KEY_LAST_QUEUED_REASON);
1076 if (queued_reason != nullptr) {
1077 result->__set_queued_reason(*queued_reason);
1078 }
1079 }
1080 }
1081 } else if (query_handle->GetCoordinator() != nullptr) {
1082 query_handle->GetCoordinator()->GetTExecSummary(result);
1083 TExecProgress progress;
1084 progress.__set_num_completed_scan_ranges(
1085 query_handle->GetCoordinator()->scan_progress().num_complete());
1086 progress.__set_total_scan_ranges(
1087 query_handle->GetCoordinator()->scan_progress().total());
1088 progress.__set_num_completed_fragment_instances(
1089 query_handle->GetCoordinator()->query_progress().num_complete());
1090 progress.__set_total_fragment_instances(
1091 query_handle->GetCoordinator()->query_progress().total());
1092 // TODO: does this not need to be synchronized?
1093 result->__set_progress(progress);
1094 } else {
1095 *result = TExecSummary();
1096 }
1097 if (query_handle->IsRetriedQuery()) {
1098 // Don't need to acquire lock on original_query_handle since the query is
1099 // finished. There are no concurrent updates on its status.
1100 result->error_logs.push_back(original_query_handle->query_status().GetDetail());
1101 result->error_logs.push_back(Substitute("Retrying query using query id: $0",
1102 PrintId(query_handle->query_id())));
1103 result->__isset.error_logs = true;
1104 if (was_retried != nullptr) {
1105 *was_retried = true;
1106 DCHECK(original_result != nullptr);
1107 // The original query could not in PENDING state because it already fails.
1108 // Handle the other two cases as above.
1109 if (original_query_handle->GetCoordinator() != nullptr) {
1110 original_query_handle->GetCoordinator()->GetTExecSummary(original_result);

Callers

nothing calls this directly

Calls 15

CheckProfileAccessFunction · 0.85
SubstituteFunction · 0.85
PrintIdFunction · 0.85
OKFunction · 0.85
effective_userMethod · 0.80
exec_stateMethod · 0.80
GetInfoStringMethod · 0.80
GetCoordinatorMethod · 0.80
GetTExecSummaryMethod · 0.80
num_completeMethod · 0.80
IsRetriedQueryMethod · 0.80

Tested by

no test coverage detected