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

Method ExecLoadDataRequestImpl

be/src/service/client-request-state.cc:941–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941void ClientRequestState::ExecLoadDataRequestImpl(bool exec_in_worker_thread) {
942 const TExecRequest& exec_req = exec_request();
943 if (exec_in_worker_thread) {
944 VLOG_QUERY << "Running in worker thread";
945 DCHECK(exec_state() == ExecState::PENDING);
946 UpdateNonErrorExecState(ExecState::RUNNING);
947 }
948 DebugActionNoFail(
949 exec_req.query_options, "CRS_DELAY_BEFORE_LOAD_DATA");
950
951 TLoadDataResp response;
952 Status status = frontend_->LoadData(exec_req.load_data_request, &response);
953 if (exec_req.load_data_request.iceberg_tbl) {
954 ExecLoadIcebergDataRequestImpl(response);
955 }
956 {
957 lock_guard<mutex> l(lock_);
958 RETURN_VOID_IF_ERROR(UpdateQueryStatus(status, exec_in_worker_thread));
959 }
960
961 request_result_set_.reset(new vector<TResultRow>);
962 request_result_set_->push_back(response.load_summary);
963
964 // We use TUpdateCatalogRequest to refresh the table metadata so that it will
965 // fire an insert event just like an insert statement.
966 TUpdatedPartition updatedPartition;
967 updatedPartition.files.insert(updatedPartition.files.end(),
968 response.loaded_files.begin(), response.loaded_files.end());
969 TUpdateCatalogRequest catalog_update;
970 // The partition_name is an empty string for unpartitioned tables.
971 catalog_update.updated_partitions[response.partition_name] = updatedPartition;
972
973 catalog_update.__set_sync_ddl(exec_req.query_options.sync_ddl);
974 catalog_update.__set_header(GetCatalogServiceRequestHeader());
975 catalog_update.target_table = exec_req.load_data_request.table_name.table_name;
976 catalog_update.db_name = exec_req.load_data_request.table_name.db_name;
977 catalog_update.is_overwrite = exec_req.load_data_request.overwrite;
978
979 CatalogServiceConnection client(ExecEnv::GetInstance()->catalogd_client_cache(),
980 *ExecEnv::GetInstance()->GetCatalogdAddress().get(), &status);
981 {
982 lock_guard<mutex> l(lock_);
983 RETURN_VOID_IF_ERROR(UpdateQueryStatus(status, exec_in_worker_thread));
984 }
985
986 TUpdateCatalogResponse resp;
987 status = client.DoRpc(
988 &CatalogServiceClientWrapper::UpdateCatalog, catalog_update, &resp);
989 query_events_->MarkEvent("UpdateCatalog finished");
990 if (resp.__isset.profile) {
991 for (const TEventSequence& catalog_timeline : resp.profile.event_sequences) {
992 summary_profile_->AddEventSequence(catalog_timeline.name, catalog_timeline);
993 }
994 }
995 {
996 lock_guard<mutex> l(lock_);
997 RETURN_VOID_IF_ERROR(UpdateQueryStatus(status, exec_in_worker_thread));
998 }

Callers

nothing calls this directly

Calls 14

DebugActionNoFailFunction · 0.85
LoadDataMethod · 0.80
push_backMethod · 0.80
catalogd_client_cacheMethod · 0.80
GetCatalogdAddressMethod · 0.80
DoRpcMethod · 0.80
MarkEventMethod · 0.80
AddEventSequenceMethod · 0.80
resetMethod · 0.65
getMethod · 0.65
insertMethod · 0.45

Tested by

no test coverage detected