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
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ option(BUILD_VELOX_BACKEND "Build Velox backend" ON)
option(BUILD_TESTS "Build Tests" OFF)
option(BUILD_EXAMPLES "Build Examples" OFF)
option(BUILD_BENCHMARKS "Build Benchmarks" OFF)
option(BUILD_TEST_UTILS "Build utils for tests/benchmarks" OFF)
option(ENABLE_JEMALLOC_STATS "Prints Jemalloc stats for debugging" OFF)
option(BUILD_GLOG "Build Glog from Source" OFF)
option(ENABLE_QAT "Enable QAT for de/compression" OFF)
Expand Down
11 changes: 9 additions & 2 deletions cpp/velox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ set(VELOX_SRCS
udf/UdfLoader.cc
utils/Common.cc
utils/ConfigExtractor.cc
utils/LocalRssClient.cc
utils/TestAllocationListener.cc
utils/VeloxArrowUtils.cc
utils/VeloxBatchResizer.cc
utils/VeloxWholeStageDumper.cc
Expand All @@ -209,6 +207,15 @@ if(ENABLE_ENHANCED_FEATURES)
compute/iceberg/IcebergWriter.cc)
endif()

if(BUILD_TESTS OR BUILD_BENCHMARKS)
set(BUILD_TEST_UTILS ON)
endif()

if(BUILD_TEST_UTILS)
list(APPEND VELOX_SRCS tests/utils/LocalRssClient.cc
tests/utils/TestAllocationListener.cc)
endif()

add_library(velox SHARED ${VELOX_SRCS})

if(ENABLE_GLUTEN_VCPKG AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
Expand Down
9 changes: 4 additions & 5 deletions cpp/velox/benchmarks/GenericBenchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
#include "shuffle/LocalPartitionWriter.h"
#include "shuffle/VeloxShuffleWriter.h"
#include "shuffle/rss/RssPartitionWriter.h"
#include "tests/utils/LocalRssClient.h"
#include "tests/utils/TestAllocationListener.h"
#include "utils/Exception.h"
#include "utils/LocalRssClient.h"
#include "utils/StringUtil.h"
#include "utils/TestAllocationListener.h"
#include "utils/Timer.h"
#include "utils/VeloxArrowUtils.h"
#include "velox/exec/PlanNodeStats.h"
Expand Down Expand Up @@ -429,9 +429,8 @@ auto BM_Generic = [](::benchmark::State& state,
std::vector<FileReaderIterator*> inputItersRaw;
if (!dataFiles.empty()) {
for (const auto& input : dataFiles) {
inputIters.push_back(
FileReaderIterator::getInputIteratorFromFileReader(
readerType, input, FLAGS_batch_size, runtime->memoryManager()->getLeafMemoryPool()));
inputIters.push_back(FileReaderIterator::getInputIteratorFromFileReader(
readerType, input, FLAGS_batch_size, runtime->memoryManager()->getLeafMemoryPool()));
}
std::transform(
inputIters.begin(),
Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/tests/VeloxColumnarBatchSerializerTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

#include <gtest/gtest.h>

#include "../utils/VeloxArrowUtils.h"
#include "compute/VeloxBackend.h"
#include "memory/ArrowMemoryPool.h"
#include "memory/VeloxColumnarBatch.h"
#include "operators/serializer/VeloxColumnarBatchSerializer.h"
#include "utils/VeloxArrowUtils.h"

#include "velox/vector/arrow/Bridge.h"
#include "velox/vector/tests/utils/VectorTestBase.h"
Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/tests/VeloxRowToColumnarTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

#include "../utils/VeloxArrowUtils.h"
#include "memory/ArrowMemoryPool.h"
#include "memory/VeloxColumnarBatch.h"
#include "operators/serializer//VeloxColumnarToRowConverter.h"
#include "operators/serializer//VeloxRowToColumnarConverter.h"
#include "utils/VeloxArrowUtils.h"
#include "velox/vector/tests/utils/VectorTestBase.h"

using namespace facebook;
Expand Down
5 changes: 1 addition & 4 deletions cpp/velox/tests/VeloxRssSortShuffleWriterTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@
#include "memory/VeloxMemoryManager.h"
#include "shuffle/VeloxRssSortShuffleWriter.h"
#include "tests/VeloxShuffleWriterTestBase.h"
#include "utils/TestAllocationListener.h"
#include "utils/TestUtils.h"
#include "tests/utils/TestUtils.h"

#include "velox/buffer/Buffer.h"
#include "velox/type/Type.h"
#include "velox/vector/tests/VectorTestUtils.h"
#include "velox/vector/tests/utils/VectorTestBase.h"

#include <cstdint>

using namespace facebook::velox;
using namespace facebook::velox::test;

Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/tests/VeloxShuffleWriterSpillTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "config/GlutenConfig.h"
#include "shuffle/VeloxHashShuffleWriter.h"
#include "tests/VeloxShuffleWriterTestBase.h"
#include "tests/utils/TestUtils.h"
#include "utils/TestAllocationListener.h"
#include "utils/TestUtils.h"

using namespace facebook::velox;

Expand Down
4 changes: 2 additions & 2 deletions cpp/velox/tests/VeloxShuffleWriterTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
#include <arrow/c/bridge.h>
#include <arrow/io/api.h>

#include "../utils/VeloxArrowUtils.h"
#include "config/GlutenConfig.h"
#include "shuffle/VeloxHashShuffleWriter.h"
#include "shuffle/VeloxRssSortShuffleWriter.h"
#include "shuffle/VeloxSortShuffleWriter.h"
#include "tests/VeloxShuffleWriterTestBase.h"
#include "tests/utils/TestUtils.h"
#include "utils/TestAllocationListener.h"
#include "utils/TestUtils.h"
#include "utils/VeloxArrowUtils.h"

#include "velox/vector/tests/utils/VectorTestBase.h"

Expand Down
2 changes: 1 addition & 1 deletion cpp/velox/tests/VeloxShuffleWriterTestBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#include <gtest/gtest.h>

#include <compute/VeloxBackend.h>
#include "../utils/VeloxArrowUtils.h"
#include "memory/VeloxColumnarBatch.h"
#include "shuffle/LocalPartitionWriter.h"
#include "shuffle/PartitionWriter.h"
#include "shuffle/VeloxShuffleReader.h"
#include "shuffle/rss/RssPartitionWriter.h"
#include "utils/LocalRssClient.h"
#include "utils/TestAllocationListener.h"
#include "utils/VeloxArrowUtils.h"
#include "velox/type/Type.h"

#include "velox/vector/tests/VectorTestUtils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include "utils/LocalRssClient.h"
#include "tests/utils/LocalRssClient.h"
#include "utils/Common.h"

#include <arrow/io/file.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include "utils/TestAllocationListener.h"
#include "tests/utils/TestAllocationListener.h"
#include "velox/common/base/SuccinctPrinter.h"

#include <fmt/format.h>
Expand Down
17 changes: 0 additions & 17 deletions cpp/core/utils/TestUtils.h → cpp/velox/tests/utils/TestUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,10 @@

#pragma once

#include <arrow/status.h>

#define ASSERT_NOT_OK(status) \
do { \
arrow::Status __s = (status); \
if (!__s.ok()) { \
throw std::runtime_error(__s.message()); \
} \
} while (false);

#define ARROW_ASSIGN_OR_THROW_IMPL(status_name, lhs, rexpr) \
do { \
auto status_name = (rexpr); \
auto __s = status_name.status(); \
if (!__s.ok()) { \
throw std::runtime_error(__s.message()); \
} \
lhs = std::move(status_name).ValueOrDie(); \
} while (false);

#define ARROW_ASSIGN_OR_THROW_NAME(x, y) ARROW_CONCAT(x, y)

#define ARROW_ASSIGN_OR_THROW(lhs, rexpr) \
ARROW_ASSIGN_OR_THROW_IMPL(ARROW_ASSIGN_OR_THROW_NAME(_error_or_value, __COUNTER__), lhs, rexpr);