Skip to content

Commit 4863718

Browse files
committed
Update TempDirectoryPath and TempFilePath path
1 parent a531e32 commit 4863718

File tree

9 files changed

+37
-31
lines changed

9 files changed

+37
-31
lines changed

presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@
2222
#include "velox/common/base/tests/GTestUtils.h"
2323
#include "velox/common/compression/Compression.h"
2424
#include "velox/common/file/FileSystems.h"
25+
#include "velox/common/testutil/TempDirectoryPath.h"
2526
#include "velox/core/QueryConfig.h"
2627
#include "velox/exec/Exchange.h"
2728
#include "velox/exec/ExchangeSource.h"
2829
#include "velox/exec/tests/utils/OperatorTestBase.h"
2930
#include "velox/exec/tests/utils/PlanBuilder.h"
3031
#include "velox/exec/tests/utils/QueryAssertions.h"
31-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
3232
#include "velox/serializers/PrestoSerializer.h"
3333

3434
using namespace facebook::velox;
35+
using namespace facebook::velox::common::testutil;
3536
using namespace facebook::presto;
3637
using namespace facebook::presto::operators;
3738

@@ -189,7 +190,7 @@ class BroadcastTest : public exec::test::OperatorTestBase,
189190
exec::Operator::registerOperator(
190191
std::make_unique<BroadcastWriteTranslator>());
191192

192-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
193+
auto tempDirectoryPath = TempDirectoryPath::create();
193194
auto [serdeRowType, broadcastFilePaths] =
194195
executeBroadcastWrite(data, tempDirectoryPath->getPath(), serdeLayout);
195196

@@ -264,7 +265,7 @@ TEST_P(BroadcastTest, endToEndSerdeLayout) {
264265
TEST_P(BroadcastTest, endToEndWithNoRows) {
265266
std::vector<RowVectorPtr> data = {makeRowVector(
266267
{makeFlatVector<double>({}), makeArrayVector<int32_t>({})})};
267-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
268+
auto tempDirectoryPath = TempDirectoryPath::create();
268269
std::vector<std::string> broadcastFilePaths;
269270

270271
// Execute write.
@@ -291,7 +292,7 @@ TEST_P(BroadcastTest, endToEndWithMultipleWriteNodes) {
291292
makeFlatVector<int32_t>({11, 21, 31, 41, 51, 61}),
292293
makeFlatVector<int64_t>({102, 203, 304, 405, 506, 607}),
293294
})};
294-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
295+
auto tempDirectoryPath = TempDirectoryPath::create();
295296
std::vector<std::string> broadcastFilePaths;
296297

297298
// Execute write.
@@ -380,7 +381,7 @@ TEST_P(BroadcastTest, malformedBroadcastInfoJson) {
380381
}
381382

382383
TEST_P(BroadcastTest, broadcastFileWriter) {
383-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
384+
auto tempDirectoryPath = TempDirectoryPath::create();
384385
auto fileSystem =
385386
velox::filesystems::getFileSystem(tempDirectoryPath->getPath(), nullptr);
386387
fileSystem->mkdir(tempDirectoryPath->getPath());
@@ -585,7 +586,7 @@ TEST_P(BroadcastTest, endToEndWithDifferentWriterPageSizes) {
585586
};
586587

587588
for (size_t i = 0; i < kPageSizes.size(); ++i) {
588-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
589+
auto tempDirectoryPath = TempDirectoryPath::create();
589590

590591
// Create a modified factory that uses custom buffer size
591592
auto fileSystem = velox::filesystems::getFileSystem(
@@ -652,7 +653,7 @@ TEST_P(BroadcastTest, endToEndWithDifferentWriterPageSizes) {
652653
}
653654

654655
TEST_P(BroadcastTest, exceedBroadcastFileWriterLimit) {
655-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
656+
auto tempDirectoryPath = TempDirectoryPath::create();
656657
auto fileSystem =
657658
velox::filesystems::getFileSystem(tempDirectoryPath->getPath(), nullptr);
658659
fileSystem->mkdir(tempDirectoryPath->getPath());
@@ -693,7 +694,7 @@ TEST_P(BroadcastTest, exceedBroadcastFileWriterLimit) {
693694
}
694695

695696
TEST_P(BroadcastTest, broadcastJoinExceedLimit) {
696-
auto tempDirectoryPath = exec::test::TempDirectoryPath::create();
697+
auto tempDirectoryPath = TempDirectoryPath::create();
697698

698699
// Create build side data (data to broadcast)
699700
auto buildData = makeRowVector({

presto-native-execution/presto_cpp/main/operators/tests/ShuffleTest.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
#include "presto_cpp/main/operators/tests/PlanBuilder.h"
2828

2929
#include "velox/common/base/tests/GTestUtils.h"
30+
#include "velox/common/testutil/TempDirectoryPath.h"
3031
#include "velox/common/testutil/TestValue.h"
3132
#include "velox/exec/Exchange.h"
3233
#include "velox/exec/ExchangeClient.h"
3334
#include "velox/exec/tests/utils/AssertQueryBuilder.h"
3435
#include "velox/exec/tests/utils/OperatorTestBase.h"
3536
#include "velox/exec/tests/utils/PlanBuilder.h"
36-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
3737
#include "velox/row/CompactRow.h"
3838
#include "velox/vector/fuzzer/VectorFuzzer.h"
3939

@@ -191,7 +191,7 @@ class ShuffleTest : public exec::test::OperatorTestBase {
191191
std::make_unique<LocalPersistentShuffleFactory>());
192192
registerExchangeSource(std::string(shuffleName_));
193193
// Create a temporary directory for shuffle files
194-
tempDir_ = exec::test::TempDirectoryPath::create();
194+
tempDir_ = TempDirectoryPath::create();
195195
}
196196

197197
void TearDown() override {
@@ -660,7 +660,7 @@ class ShuffleTest : public exec::test::OperatorTestBase {
660660
{"c16", MAP(TINYINT(), REAL())},
661661
});
662662

663-
auto rootDirectory = velox::exec::test::TempDirectoryPath::create();
663+
auto rootDirectory = TempDirectoryPath::create();
664664
auto rootPath = rootDirectory->getPath();
665665
const std::string shuffleWriteInfo =
666666
localShuffleWriteInfo(rootPath, numPartitions);
@@ -701,7 +701,7 @@ class ShuffleTest : public exec::test::OperatorTestBase {
701701
}
702702

703703
std::string_view shuffleName_;
704-
std::shared_ptr<exec::test::TempDirectoryPath> tempDir_;
704+
std::shared_ptr<TempDirectoryPath> tempDir_;
705705
enum class DataType {
706706
BASIC,
707707
BASIC_WITH_NULLS,
@@ -1412,10 +1412,10 @@ TEST_F(ShuffleTest, shuffleEndToEnd) {
14121412
for (const auto& config : testSettings) {
14131413
SCOPED_TRACE(config.debugString());
14141414

1415-
std::shared_ptr<exec::test::TempDirectoryPath> customTempDir;
1415+
std::shared_ptr<TempDirectoryPath> customTempDir;
14161416
std::string rootPath;
14171417
if (config.useCustomTempDir) {
1418-
customTempDir = exec::test::TempDirectoryPath::create();
1418+
customTempDir = TempDirectoryPath::create();
14191419
rootPath = customTempDir->getPath();
14201420
} else {
14211421
rootPath = tempDir_->getPath();
@@ -1564,7 +1564,7 @@ TEST_F(ShuffleTest, shuffleWriterReader) {
15641564
for (const auto& config : testSettings) {
15651565
SCOPED_TRACE(config.debugString());
15661566

1567-
auto tempRootDir = velox::exec::test::TempDirectoryPath::create();
1567+
auto tempRootDir = TempDirectoryPath::create();
15681568
const auto testRootPath = tempRootDir->getPath();
15691569

15701570
LocalShuffleWriteInfo writeInfo = LocalShuffleWriteInfo::deserialize(

presto-native-execution/presto_cpp/main/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ if(PRESTO_ENABLE_REMOTE_FUNCTIONS)
9090
presto_server_remote_function_test
9191
presto_server_remote_function
9292
velox_expression
93-
velox_temp_path
93+
velox_test_util
9494
GTest::gmock
9595
GTest::gtest
9696
GTest::gtest_main

presto-native-execution/presto_cpp/main/tests/LinuxMemoryCheckerTest.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
#include <gtest/gtest.h>
1818
#include "velox/common/base/VeloxException.h"
1919
#include "velox/common/base/tests/GTestUtils.h"
20-
#include "velox/exec/tests/utils/TempFilePath.h"
20+
#include "velox/common/testutil/TempFilePath.h"
2121

2222
using namespace facebook::velox;
23+
using namespace facebook::velox::common::testutil;
2324

2425
namespace facebook::presto {
2526
class LinuxMemoryCheckerTest : public testing::Test {
@@ -31,11 +32,11 @@ class LinuxMemoryCheckerTest : public testing::Test {
3132
void checkAvailableMemoryOfDeployment(
3233
const std::string& content,
3334
int64_t expectedMemoryMax) {
34-
auto tempMemInfoFile = exec::test::TempFilePath::create();
35+
auto tempMemInfoFile = TempFilePath::create();
3536
tempMemInfoFile->append(kMemInfoText_);
3637
auto memInfoPath = tempMemInfoFile->getPath();
3738

38-
auto tempMemMaxFile = exec::test::TempFilePath::create();
39+
auto tempMemMaxFile = TempFilePath::create();
3940
tempMemMaxFile->append(content);
4041
auto tempMemMaxFilePath = tempMemMaxFile->getPath();
4142

@@ -47,7 +48,7 @@ class LinuxMemoryCheckerTest : public testing::Test {
4748
void checkMemoryUsage(
4849
const std::string& content,
4950
int64_t expectedMemoryUsage) {
50-
auto tempTestFile = exec::test::TempFilePath::create();
51+
auto tempTestFile = TempFilePath::create();
5152
tempTestFile->append(content);
5253
auto testFilePath = tempTestFile->getPath();
5354

@@ -147,11 +148,11 @@ TEST_F(LinuxMemoryCheckerTest, basic) {
147148
}
148149

149150
TEST_F(LinuxMemoryCheckerTest, sysMemLimitBytesCheck) {
150-
auto tempMemInfoFile = exec::test::TempFilePath::create();
151+
auto tempMemInfoFile = TempFilePath::create();
151152
tempMemInfoFile->append(kMemInfoText_);
152153
auto memInfoPath = tempMemInfoFile->getPath();
153154

154-
auto tempTestFile = exec::test::TempFilePath::create();
155+
auto tempTestFile = TempFilePath::create();
155156
tempTestFile->append("131000000000\n");
156157
auto memMaxFilePath = tempTestFile->getPath();
157158

presto-native-execution/presto_cpp/main/tests/RemoteFunctionRegistererTest.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
#include <gtest/gtest.h>
1717
#include <fstream>
1818
#include "velox/common/base/Fs.h"
19-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
20-
#include "velox/exec/tests/utils/TempFilePath.h"
19+
#include "velox/common/testutil/TempDirectoryPath.h"
20+
#include "velox/common/testutil/TempFilePath.h"
2121
#include "velox/expression/VectorFunction.h"
2222

2323
using namespace facebook::velox;
24+
using namespace facebook::velox::common::testutil;
2425

2526
namespace facebook::presto::test {
2627
namespace {
@@ -56,7 +57,7 @@ TEST_F(RemoteFunctionRegistererTest, singleFile) {
5657
})";
5758

5859
// Write to a single output file.
59-
auto path = exec::test::TempFilePath::create();
60+
auto path = TempFilePath::create();
6061
writeToFile(path->getPath(), json);
6162

6263
// Check functions do not exist first.
@@ -86,7 +87,7 @@ TEST_F(RemoteFunctionRegistererTest, prefixes) {
8687
})";
8788

8889
// Write to a single output file.
89-
auto path = exec::test::TempFilePath::create();
90+
auto path = TempFilePath::create();
9091
writeToFile(path->getPath(), json);
9192

9293
EXPECT_TRUE(exec::getVectorFunctionSignatures("mock3") == std::nullopt);
@@ -124,7 +125,7 @@ std::string getJson(const std::string& functionName) {
124125
}
125126

126127
TEST_F(RemoteFunctionRegistererTest, directory) {
127-
auto tempDir = exec::test::TempDirectoryPath::create();
128+
auto tempDir = TempDirectoryPath::create();
128129

129130
// Create the following structure:
130131
//

presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "velox/common/base/Fs.h"
2727
#include "velox/common/base/tests/GTestUtils.h"
2828
#include "velox/common/file/FileSystems.h"
29+
#include "velox/common/testutil/TempDirectoryPath.h"
2930
#include "velox/connectors/hive/HiveConnector.h"
3031
#include "velox/dwio/common/FileSink.h"
3132
#include "velox/dwio/common/WriterFactory.h"
@@ -36,7 +37,6 @@
3637
#include "velox/exec/tests/utils/OperatorTestBase.h"
3738
#include "velox/exec/tests/utils/PlanBuilder.h"
3839
#include "velox/exec/tests/utils/QueryAssertions.h"
39-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
4040
#include "velox/type/Type.h"
4141

4242
DECLARE_int32(old_task_ms);
@@ -45,6 +45,7 @@ DECLARE_bool(velox_memory_leak_check_enabled);
4545
static const std::string kHiveConnectorId = "test-hive";
4646

4747
using namespace facebook::velox;
48+
using namespace facebook::velox::common::testutil;
4849
using namespace facebook::velox::exec;
4950
using namespace facebook::velox::exec::test;
5051

presto-native-execution/presto_cpp/main/tool/trace/tests/BroadcastWriteReplayerTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020

2121
#include "presto_cpp/main/operators/BroadcastWrite.h"
2222
#include "presto_cpp/main/tool/trace/BroadcastWriteReplayer.h"
23+
#include "velox/common/testutil/TempDirectoryPath.h"
2324
#include "velox/exec/OperatorTraceReader.h"
2425
#include "velox/exec/TraceUtil.h"
2526
#include "velox/exec/tests/utils/AssertQueryBuilder.h"
2627
#include "velox/exec/tests/utils/HiveConnectorTestBase.h"
2728
#include "velox/exec/tests/utils/PlanBuilder.h"
28-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
2929
#include "velox/serializers/PrestoSerializer.h"
3030

3131
using namespace facebook::velox;
32+
using namespace facebook::velox::common::testutil;
3233
using namespace facebook::velox::exec;
3334
using namespace facebook::velox::exec::test;
3435
using namespace facebook::velox::tool::trace;

presto-native-execution/presto_cpp/main/tool/trace/tests/PartitionAndSerializeReplayerTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
#include "presto_cpp/main/operators/PartitionAndSerialize.h"
2323
#include "presto_cpp/main/operators/tests/PlanBuilder.h"
2424
#include "presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h"
25+
#include "velox/common/testutil/TempDirectoryPath.h"
2526
#include "velox/exec/PartitionFunction.h"
2627
#include "velox/exec/TraceUtil.h"
2728
#include "velox/exec/tests/utils/AssertQueryBuilder.h"
2829
#include "velox/exec/tests/utils/HiveConnectorTestBase.h"
2930
#include "velox/exec/tests/utils/PlanBuilder.h"
30-
#include "velox/exec/tests/utils/TempDirectoryPath.h"
3131

3232
using namespace facebook::velox;
33+
using namespace facebook::velox::common::testutil;
3334
using namespace facebook::velox::exec;
3435
using namespace facebook::velox::exec::test;
3536
using namespace facebook::velox::tool::trace;

presto-native-execution/velox

Submodule velox updated from 9ea14c1 to 492af4b

0 commit comments

Comments
 (0)