Skip to content

Commit

Permalink
[native] Replace DWRF writer creation with common factory creation
Browse files Browse the repository at this point in the history
This removes the dependency on the DWRF writer header which has
dependencies on protobuf that Prestissimo does not have.
  • Loading branch information
czentgr authored and majetideepak committed Oct 17, 2023
1 parent 71d5640 commit c2b7f2c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "velox/common/base/Fs.h"
#include "velox/common/encode/Base64.h"
#include "velox/common/file/FileSystems.h"
#include "velox/dwio/dwrf/writer/Writer.h"
#include "velox/dwio/common/WriterFactory.h"
#include "velox/exec/tests/utils/QueryAssertions.h"
#include "velox/serializers/PrestoSerializer.h"

Expand All @@ -45,18 +45,19 @@ void writeToFile(
memory::MemoryPool* pool) {
VELOX_CHECK_GT(data.size(), 0);

dwrf::WriterOptions options;
dwio::common::WriterOptions options;
options.schema = data[0]->type();
options.memoryPool = pool;

auto writeFile = std::make_unique<LocalWriteFile>(path, true, false);
auto sink =
std::make_unique<dwio::common::WriteFileSink>(std::move(writeFile), path);
dwrf::Writer writer(std::move(sink), options);
auto writer = dwio::common::getWriterFactory(dwio::common::FileFormat::DWRF)
->createWriter(std::move(sink), options);
for (const auto& vector : data) {
writer.write(vector);
writer->write(vector);
}
writer.close();
writer->close();
}

std::unique_ptr<ByteStream> toByteStream(const std::string& input) {
Expand Down

0 comments on commit c2b7f2c

Please sign in to comment.