Skip to content

Commit

Permalink
Remove ::test namespace from cursor.h (#12014)
Browse files Browse the repository at this point in the history
Summary:
X-link: prestodb/presto#24319


The methods/classes in cusor.h should not be in ::test namespace. Updated the declaration as well as all the references.

Reviewed By: xiaoxmeng

Differential Revision: D67775554
  • Loading branch information
zation99 authored and facebook-github-bot committed Jan 3, 2025
1 parent 37292fa commit ee9fe3a
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions velox/benchmarks/QueryBenchmarkBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class QueryBenchmarkBase {
virtual ~QueryBenchmarkBase() = default;
virtual void initialize();
void shutdown();
std::pair<std::unique_ptr<exec::test::TaskCursor>, std::vector<RowVectorPtr>>
run(const exec::test::TpchPlan& tpchPlan);
std::pair<std::unique_ptr<exec::TaskCursor>, std::vector<RowVectorPtr>> run(
const exec::test::TpchPlan& tpchPlan);

virtual std::vector<std::shared_ptr<connector::ConnectorSplit>> listSplits(
const std::string& path,
Expand Down
4 changes: 2 additions & 2 deletions velox/connectors/tpch/tests/SpeedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ class TpchSpeedTest {
auto startTime = system_clock::now();
intervalStart_ = startTime;

CursorParameters params;
exec::CursorParameters params;
params.planNode = plan;
params.maxDrivers = FLAGS_max_drivers;

auto taskCursor = TaskCursor::create(params);
auto taskCursor = exec::TaskCursor::create(params);
taskCursor->start();

auto task = taskCursor->task();
Expand Down
4 changes: 2 additions & 2 deletions velox/exec/Cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <filesystem>

namespace facebook::velox::exec::test {
namespace facebook::velox::exec {

bool waitForTaskDriversToFinish(exec::Task* task, uint64_t maxWaitMicros) {
VELOX_USER_CHECK(!task->isRunning());
Expand Down Expand Up @@ -460,4 +460,4 @@ bool RowCursor::hasNext() {
return currentRow_ < numRows_ || cursor_->hasNext();
}

} // namespace facebook::velox::exec::test
} // namespace facebook::velox::exec
4 changes: 2 additions & 2 deletions velox/exec/Cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "velox/core/PlanNode.h"
#include "velox/exec/Task.h"

namespace facebook::velox::exec::test {
namespace facebook::velox::exec {

/// Wait up to maxWaitMicros for all the task drivers to finish. The function
/// returns true if all the drivers have finished, otherwise false.
Expand Down Expand Up @@ -186,4 +186,4 @@ class RowCursor {
vector_size_t numRows_ = 0;
};

} // namespace facebook::velox::exec::test
} // namespace facebook::velox::exec
1 change: 1 addition & 0 deletions velox/exec/tests/AssignUniqueIdTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

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

class AssignUniqueIdTest : public OperatorTestBase {
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/EnforceSingleRowTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "velox/exec/tests/utils/PlanBuilder.h"

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

class EnforceSingleRowTest : public OperatorTestBase {
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/LimitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "velox/exec/tests/utils/PlanBuilder.h"

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

class LimitTest : public HiveConnectorTestBase {};
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/MergeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "velox/exec/tests/utils/PlanBuilder.h"

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

class MergeTest : public OperatorTestBase {
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/QueryAssertionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "velox/vector/fuzzer/VectorFuzzer.h"
#include "velox/vector/tests/utils/VectorTestBase.h"

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

Expand Down
4 changes: 2 additions & 2 deletions velox/exec/tests/TableScanTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4100,14 +4100,14 @@ TEST_F(TableScanTest, addSplitsToFailedTask) {
writeToFile(filePath->getPath(), {data});

core::PlanNodeId scanNodeId;
exec::test::CursorParameters params;
CursorParameters params;
params.planNode = exec::test::PlanBuilder()
.tableScan(ROW({"c0"}, {INTEGER()}))
.capturePlanNodeId(scanNodeId)
.project({"5 / c0"})
.planNode();

auto cursor = exec::test::TaskCursor::create(params);
auto cursor = TaskCursor::create(params);
cursor->task()->addSplit(scanNodeId, makeHiveSplit(filePath->getPath()));

EXPECT_THROW(while (cursor->moveNext()){}, VeloxUserError);
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/TaskListenerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "velox/exec/tests/utils/PlanBuilder.h"

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

struct TaskCompletedEvent {
Expand Down
1 change: 1 addition & 0 deletions velox/exec/tests/UnnestTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "velox/exec/tests/utils/PlanBuilder.h"

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

class UnnestTest : public OperatorTestBase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include "velox/expression/Expr.h"
#include "velox/expression/SignatureBinder.h"

using facebook::velox::exec::CursorParameters;
using facebook::velox::exec::test::AssertQueryBuilder;
using facebook::velox::exec::test::CursorParameters;
using facebook::velox::exec::test::PlanBuilder;
using facebook::velox::test::VectorMaker;

Expand Down
2 changes: 1 addition & 1 deletion velox/runner/LocalRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void LocalRunner::start() {
VELOX_CHECK_EQ(state_, State::kInitialized);
auto lastStage = makeStages();
params_.planNode = plan_->fragments().back().fragment.planNode;
auto cursor = exec::test::TaskCursor::create(params_);
auto cursor = exec::TaskCursor::create(params_);
stages_.push_back({cursor->task()});
// Add table scan splits to the final gathere stage.
for (auto& scan : fragments_.back().scans) {
Expand Down
4 changes: 2 additions & 2 deletions velox/runner/LocalRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class LocalRunner : public Runner,
const std::vector<ExecutableFragment> fragments_;
const MultiFragmentPlan::Options& options_;

exec::test::CursorParameters params_;
exec::CursorParameters params_;

tsan_atomic<State> state_{State::kInitialized};

std::unique_ptr<exec::test::TaskCursor> cursor_;
std::unique_ptr<exec::TaskCursor> cursor_;
std::vector<std::vector<std::shared_ptr<exec::Task>>> stages_;
std::exception_ptr error_;
std::shared_ptr<SplitSourceFactory> splitSourceFactory_;
Expand Down
1 change: 1 addition & 0 deletions velox/substrait/tests/VeloxSubstraitRoundTripTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

using namespace facebook::velox;
using namespace facebook::velox::test;
using namespace facebook::velox::exec;
using namespace facebook::velox::exec::test;
using namespace facebook::velox::substrait;

Expand Down
2 changes: 1 addition & 1 deletion velox/tool/trace/TraceReplayTaskRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace facebook::velox::tool::trace {

std::pair<std::shared_ptr<exec::Task>, RowVectorPtr> TraceReplayTaskRunner::run(
bool copyResults) {
auto cursor = exec::test::TaskCursor::create(cursorParams_);
auto cursor = exec::TaskCursor::create(cursorParams_);
std::vector<RowVectorPtr> results;
auto* task = cursor->task().get();
addSplits(task);
Expand Down
2 changes: 1 addition & 1 deletion velox/tool/trace/TraceReplayTaskRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class TraceReplayTaskRunner {
static std::shared_ptr<RowVector> copy(
const std::vector<RowVectorPtr>& results);

exec::test::CursorParameters cursorParams_;
exec::CursorParameters cursorParams_;
std::unordered_map<core::PlanNodeId, std::vector<exec::Split>> splits_;
bool noMoreSplits_ = false;
};
Expand Down

0 comments on commit ee9fe3a

Please sign in to comment.