Skip to content

Commit

Permalink
Remove foreign dependencies on VeloxWriterTest
Browse files Browse the repository at this point in the history
Summary:
Removing dependency on internal library, and unnecessary dependency on
velox_exec.

Reviewed By: zzhao0

Differential Revision: D56556439

fbshipit-source-id: 479fdf3bd222eb3e56435c1ea792cff4779d8975
  • Loading branch information
pedroerp authored and facebook-github-bot committed Apr 25, 2024
1 parent 9dba0cd commit af5949d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions dwio/nimble/velox/tests/VeloxWriterTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <gtest/gtest.h>
#include <zstd.h>

#include "common/strings/UUID.h"
#include "dwio/nimble/common/EncodingPrimitives.h"
#include "dwio/nimble/common/tests/TestUtils.h"
#include "dwio/nimble/encodings/EncodingLayoutCapture.h"
Expand All @@ -28,8 +27,9 @@
#include "dwio/nimble/velox/VeloxReader.h"
#include "dwio/nimble/velox/VeloxWriter.h"
#include "folly/FileUtil.h"
#include "folly/Random.h"
#include "velox/common/memory/MemoryArbitrator.h"
#include "velox/common/memory/SharedArbitrator.h"
#include "velox/exec/MemoryReclaimer.h"
#include "velox/vector/VectorStream.h"
#include "velox/vector/fuzzer/VectorFuzzer.h"
#include "velox/vector/tests/utils/VectorMaker.h"
Expand Down Expand Up @@ -73,16 +73,21 @@ TEST_F(VeloxWriterTests, ExceptionOnClose) {
class ThrowingWriteFile final : public velox::WriteFile {
public:
void append(std::string_view /* data */) final {
throw std::runtime_error("error/" + strings::generateUUID());
throw std::runtime_error(uniqueErrorMessage());
}
void flush() final {
throw std::runtime_error("error/" + strings::generateUUID());
throw std::runtime_error(uniqueErrorMessage());
}
void close() final {
throw std::runtime_error("error/" + strings::generateUUID());
throw std::runtime_error(uniqueErrorMessage());
}
uint64_t size() const final {
throw std::runtime_error("error/" + strings::generateUUID());
throw std::runtime_error(uniqueErrorMessage());
}

private:
std::string uniqueErrorMessage() const {
return "error/" + folly::to<std::string>(folly::Random::rand32());
}
};

Expand Down Expand Up @@ -309,9 +314,9 @@ class MockReclaimer : public velox::memory::MemoryReclaimer {

TEST_F(VeloxWriterTests, MemoryReclaimPath) {
auto rootPool = velox::memory::memoryManager()->addRootPool(
"root", 4L << 20, velox::exec::MemoryReclaimer::create());
"root", 4L << 20, velox::memory::MemoryReclaimer::create());
auto writerPool = rootPool->addAggregateChild(
"writer", velox::exec::MemoryReclaimer::create());
"writer", velox::memory::MemoryReclaimer::create());

auto type = velox::ROW(
{{"simple_int", velox::INTEGER()}, {"simple_double", velox::DOUBLE()}});
Expand Down

0 comments on commit af5949d

Please sign in to comment.