Skip to content
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
21 changes: 13 additions & 8 deletions presto-native-execution/presto_cpp/main/QueryContextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,17 @@ std::unordered_map<std::string, std::string> toVeloxConfigs(
}

std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
toConnectorConfigs(const protocol::SessionRepresentation& session) {
toConnectorConfigs(const protocol::TaskUpdateRequest& taskUpdateRequest) {
std::unordered_map<std::string, std::unordered_map<std::string, std::string>>
connectorConfigs;
for (const auto& entry : session.catalogProperties) {
connectorConfigs.insert(
{entry.first,
std::unordered_map<std::string, std::string>(
entry.second.begin(), entry.second.end())});
for (const auto& entry : taskUpdateRequest.session.catalogProperties) {
auto sessionProperties = std::unordered_map<std::string, std::string>(
entry.second.begin(), entry.second.end());
sessionProperties.insert(
taskUpdateRequest.extraCredentials.begin(),
taskUpdateRequest.extraCredentials.end());
sessionProperties.insert({"user", taskUpdateRequest.session.user});
connectorConfigs.insert({entry.first, sessionProperties});
}

return connectorConfigs;
Expand Down Expand Up @@ -152,9 +155,11 @@ QueryContextManager::QueryContextManager(
std::shared_ptr<velox::core::QueryCtx>
QueryContextManager::findOrCreateQueryCtx(
const protocol::TaskId& taskId,
const protocol::SessionRepresentation& session) {
const protocol::TaskUpdateRequest& taskUpdateRequest) {
return findOrCreateQueryCtx(
taskId, toVeloxConfigs(session), toConnectorConfigs(session));
taskId,
toVeloxConfigs(taskUpdateRequest.session),
toConnectorConfigs(taskUpdateRequest));
}

std::shared_ptr<core::QueryCtx> QueryContextManager::findOrCreateQueryCtx(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class QueryContextManager {

std::shared_ptr<velox::core::QueryCtx> findOrCreateQueryCtx(
const protocol::TaskId& taskId,
const protocol::SessionRepresentation& session);
const protocol::TaskUpdateRequest& taskUpdateRequest);

/// Calls the given functor for every present query context.
void visitAllContexts(std::function<void(
Expand Down
4 changes: 2 additions & 2 deletions presto-native-execution/presto_cpp/main/TaskResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ proxygen::RequestHandler* TaskResource::createOrUpdateBatchTask(

auto queryCtx =
taskManager_.getQueryContextManager()->findOrCreateQueryCtx(
taskId, updateRequest.session);
taskId, updateRequest);

VeloxBatchQueryPlanConverter converter(
shuffleName,
Expand Down Expand Up @@ -339,7 +339,7 @@ proxygen::RequestHandler* TaskResource::createOrUpdateTask(

queryCtx =
taskManager_.getQueryContextManager()->findOrCreateQueryCtx(
taskId, updateRequest.session);
taskId, updateRequest);

VeloxInteractiveQueryPlanConverter converter(queryCtx.get(), pool_);
planFragment = converter.toVeloxQueryPlan(
Expand Down