Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "velox/dwio/common/FileSink.h"
#include "velox/dwio/common/WriterFactory.h"
#include "velox/dwio/common/tests/utils/BatchMaker.h"
#include "velox/dwio/dwrf/writer/Writer.h"
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.

@kewang1024 Can you please explain why making this change? The TaskManagerTest is file-format orthogonal and should NOT depend on DWRF. We've been trying to remove DWRF dependencies from HiveConnectorTest as well, e.g. facebookincubator/velox#10150

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Essentially we want to make common::WriterOptions::processConfigs function pure virtual to make sure every data format will implement its own.
As a result, common::WriterOptions can not be initiated.

cc: @xiaoxmeng

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.

@yingsu00 good point. We might need this change as we disable creation of dwio common writer options as it is an abstract class now. If we want to cover parquet file format here, then we can make this a parameterized test with different file formats. But I guess it is not required for TaskManagerTest.

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.

I think this will break Meta internal test as Velox side change on Writer options is landed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need this header still?

#include "velox/exec/Exchange.h"
#include "velox/exec/Values.h"
#include "velox/exec/tests/utils/PlanBuilder.h"
Expand Down Expand Up @@ -270,6 +271,8 @@ class TaskManagerTest : public testing::Test {
"http://{}:{}",
serverAddress.getAddressStr(),
serverAddress.getPort()));
writerFactory_ =
dwio::common::getWriterFactory(dwio::common::FileFormat::DWRF);
}

void TearDown() override {
Expand Down Expand Up @@ -299,13 +302,13 @@ class TaskManagerTest : public testing::Test {
void writeToFile(
const std::string& filePath,
const std::vector<RowVectorPtr>& vectors) {
auto options = std::make_shared<dwio::common::WriterOptions>();
auto options = writerFactory_->createWriterOptions();
options->schema = rowType_;
options->memoryPool = rootPool_.get();
auto sink = std::make_unique<dwio::common::LocalFileSink>(
filePath, dwio::common::FileSink::Options{});
auto writer = dwio::common::getWriterFactory(dwio::common::FileFormat::DWRF)
->createWriter(std::move(sink), options);
auto writer =
writerFactory_->createWriter(std::move(sink), std::move(options));

for (size_t i = 0; i < vectors.size(); ++i) {
writer->write(vectors[i]);
Expand Down Expand Up @@ -674,6 +677,7 @@ class TaskManagerTest : public testing::Test {
long splitSequenceId_{0};
std::shared_ptr<http::HttpClientConnectionPool> connPool_ =
std::make_shared<http::HttpClientConnectionPool>();
std::shared_ptr<dwio::common::WriterFactory> writerFactory_;
};

// Runs "select * from t where c0 % 5 = 0" query.
Expand Down