Skip to content
Merged
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
10 changes: 6 additions & 4 deletions presto-native-execution/presto_cpp/main/TaskResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,20 @@ void TaskResource::registerUris(http::HttpServer& server) {
return acknowledgeResults(message, pathMatch);
});

// task/(.+)/batch must come before the /v1/task/(.+) as it's more specific
// otherwise all requests will be matched with /v1/task/(.+)
server.registerPost(
R"(/v1/task/(.+))",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix. Can we also add comments on top of this endpoint to note the importance of the ordering?

R"(/v1/task/(.+)/batch)",
[&](proxygen::HTTPMessage* message,
const std::vector<std::string>& pathMatch) {
return createOrUpdateTask(message, pathMatch);
return createOrUpdateBatchTask(message, pathMatch);
});

server.registerPost(
R"(/v1/task/(.+)/batch)",
R"(/v1/task/(.+))",
[&](proxygen::HTTPMessage* message,
const std::vector<std::string>& pathMatch) {
return createOrUpdateBatchTask(message, pathMatch);
return createOrUpdateTask(message, pathMatch);
});

server.registerDelete(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2151,23 +2151,25 @@ velox::core::PlanFragment VeloxQueryPlanConverter::toBatchVeloxQueryPlan(
std::shared_ptr<std::string>&& serializedShuffleWriteInfo) {
auto planFragment = toVeloxQueryPlan(fragment, tableWriteInfo, taskId);

// If the last node is a PartitionedOutputNode, it means this fragment ends
// with a shuffle stage. We convert the PartitionedOutputNode to a chain of
// following nodes:
// If the serializedShuffleWriteInfo is not nullptr, it means this fragment
// ends with a shuffle stage. We convert the PartitionedOutputNode to a
// chain of following nodes:
// (1) A PartitionAndSerializeNode.
// (2) A "gather" LocalPartitionNode that gathers results from multiple
// threads to one thread.
// (3) A ShuffleWriteNode.
// To be noted, whether the last node of the plan is PartitionedOutputNode
// can't guarantee the query has shuffle stage, for example a plan with
// TableWriteNode can also have PartitionedOutputNode to distribute the
// metadata to coordinator.
if (serializedShuffleWriteInfo == nullptr) {
return planFragment;
}
auto partitionedOutputNode =
std::dynamic_pointer_cast<const core::PartitionedOutputNode>(
planFragment.planNode);
VELOX_CHECK_EQ(
partitionedOutputNode == nullptr,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay so this check is actually wrong. Good to know table write ends with an partitioned output node.

serializedShuffleWriteInfo == nullptr,
"Writer shuffle info and PartitionedOutputNode should be set together");
if (partitionedOutputNode == nullptr) {
return planFragment;
}
VELOX_CHECK(
partitionedOutputNode != nullptr, "PartitionedOutputNode is required");
if (partitionedOutputNode->isBroadcast()) {
VELOX_UNSUPPORTED(
"Broadcast partitioned output node in batch is currently not "
Expand Down