-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT: Add runner for local distributed execution (#11609)
Summary: Adds LocalRunner and LocalSchema for running distributed Velox plans in-process with multiple fragments and multiple tasks per fragment. This introduces the abstractions for distributed plans, their options, schema and split sources. Adds an extension of PlanBuilder for building plan trees with shuffles. These get partitioned into multiple plan trees for execution with LocalRunner. Adds LocalRunnerTestBase, a test base class with utilities for generating multiple tables each with multiple files of test data. These are then returned as a LocalSchema that can be used to produce splits for LocalRunner. Adds error propagation for TaskCursor since distributed plans may have to produce errors from any fragment that are consumed by the application via TaskCursor. This will be generalized to distributed execution on a cluster with Velox coordination and shuffles. Pull Request resolved: #11609 Reviewed By: xiaoxmeng Differential Revision: D66261119 Pulled By: oerling fbshipit-source-id: 79e72f2fd407a14a24a3ee71a23f2e309237a47b
- Loading branch information
1 parent
1b75704
commit 44e05dd
Showing
28 changed files
with
2,229 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "gtest/gtest.h" | ||
#include "velox/common/config/Config.h" | ||
#include "velox/connectors/hive/HiveConnectorSplit.h" | ||
|
||
using namespace facebook::velox; | ||
using namespace facebook::velox::connector::hive; | ||
|
||
TEST(HiveSplitTest, builder) { | ||
FileProperties properties = {11, 1111}; | ||
auto extra = std::make_shared<std::string>("extra file info"); | ||
std::unordered_map<std::string, std::string> custom; | ||
custom["custom1"] = "customValue1"; | ||
std::unordered_map<std::string, std::string> serde; | ||
serde["serde1"] = "serdeValue1"; | ||
auto split = HiveConnectorSplitBuilder("filepath") | ||
.start(100) | ||
.length(100000) | ||
.splitWeight(1) | ||
.fileFormat(dwio::common::FileFormat::DWRF) | ||
.infoColumn("info1", "infoValue1") | ||
.partitionKey("DS", "2024-11-01") | ||
.tableBucketNumber(11) | ||
.customSplitInfo(custom) | ||
.extraFileInfo(extra) | ||
.serdeParameters(serde) | ||
.connectorId("connectorId") | ||
.fileProperties(properties) | ||
.build(); | ||
|
||
EXPECT_EQ(100, split->start); | ||
EXPECT_EQ(100000, split->length); | ||
EXPECT_EQ(1, split->splitWeight); | ||
EXPECT_TRUE(dwio::common::FileFormat::DWRF == split->fileFormat); | ||
EXPECT_EQ("infoValue1", split->infoColumns["info1"]); | ||
auto it = split->partitionKeys.find("DS"); | ||
EXPECT_TRUE(it != split->partitionKeys.end()); | ||
EXPECT_EQ("2024-11-01", it->second.value()); | ||
EXPECT_EQ(11, split->tableBucketNumber.value()); | ||
EXPECT_EQ("customValue1", split->customSplitInfo["custom1"]); | ||
EXPECT_EQ(std::string("extra file info"), *split->extraFileInfo); | ||
EXPECT_EQ("serdeValue1", split->serdeParameters["serde1"]); | ||
EXPECT_EQ("connectorId", split->connectorId); | ||
EXPECT_EQ( | ||
properties.fileSize.value(), split->properties.value().fileSize.value()); | ||
EXPECT_EQ( | ||
properties.modificationTime.value(), | ||
split->properties.value().modificationTime.value()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.