diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 5ee52935cc224..f70b079af19c1 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -71,6 +71,8 @@ #include #endif +using namespace facebook::velox; + namespace facebook::presto { namespace { diff --git a/presto-native-execution/presto_cpp/main/http/tests/HttpTest.cpp b/presto-native-execution/presto_cpp/main/http/tests/HttpTest.cpp index 83db0b0774f1d..eaf0cfb0da6d5 100644 --- a/presto-native-execution/presto_cpp/main/http/tests/HttpTest.cpp +++ b/presto-native-execution/presto_cpp/main/http/tests/HttpTest.cpp @@ -13,6 +13,9 @@ */ #include "presto_cpp/main/http/tests/HttpTestBase.h" +using namespace facebook::presto; +using namespace facebook::velox; + int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); folly::Init init{&argc, &argv}; diff --git a/presto-native-execution/presto_cpp/main/http/tests/HttpTestBase.h b/presto-native-execution/presto_cpp/main/http/tests/HttpTestBase.h index 2907130a596b6..71427202f7dd1 100644 --- a/presto-native-execution/presto_cpp/main/http/tests/HttpTestBase.h +++ b/presto-native-execution/presto_cpp/main/http/tests/HttpTestBase.h @@ -25,10 +25,6 @@ namespace fs = boost::filesystem; -using namespace facebook::presto; -using namespace facebook::velox; -using namespace facebook::velox::memory; - std::string getCertsPath(const std::string& fileName) { std::string currentPath = fs::current_path().c_str(); if (boost::algorithm::ends_with(currentPath, "fbcode")) { @@ -65,7 +61,8 @@ inline folly::SSLContextPtr makeSslContext() { class HttpServerWrapper { public: - explicit HttpServerWrapper(std::unique_ptr server) + explicit HttpServerWrapper( + std::unique_ptr server) : server_(std::move(server)) {} ~HttpServerWrapper() { @@ -100,7 +97,7 @@ class HttpServerWrapper { } private: - std::unique_ptr server_; + std::unique_ptr server_; std::unique_ptr serverThread_; folly::Promise promise_; std::vector> filters_ = {}; @@ -136,7 +133,9 @@ void ping( proxygen::HTTPMessage* /*message*/, std::vector>& /*body*/, proxygen::ResponseHandler* downstream) { - proxygen::ResponseBuilder(downstream).status(http::kHttpOk, "").sendWithEOM(); + proxygen::ResponseBuilder(downstream) + .status(facebook::presto::http::kHttpOk, "") + .sendWithEOM(); } void blackhole( @@ -144,7 +143,9 @@ void blackhole( std::vector>& /*body*/, proxygen::ResponseHandler* downstream) {} -std::string bodyAsString(http::HttpResponse& response, MemoryPool* pool) { +std::string bodyAsString( + facebook::presto::http::HttpResponse& response, + facebook::velox::memory::MemoryPool* pool) { EXPECT_FALSE(response.hasError()); std::ostringstream oss; auto iobufs = response.consumeBody(); @@ -170,7 +171,7 @@ void echo( proxygen::ResponseHandler* downstream) { if (body.empty()) { proxygen::ResponseBuilder(downstream) - .status(http::kHttpOk, "") + .status(facebook::presto::http::kHttpOk, "") .body(folly::IOBuf::wrapBuffer( message->getURL().c_str(), message->getURL().size())) .sendWithEOM(); @@ -178,7 +179,7 @@ void echo( } proxygen::ResponseBuilder(downstream) - .status(http::kHttpOk, "") + .status(facebook::presto::http::kHttpOk, "") .header(proxygen::HTTP_HEADER_CONTENT_TYPE, "text/plain") .body(toString(body)) .sendWithEOM(); @@ -196,14 +197,14 @@ class HttpClientFactory { eventBaseThread_->join(); } - std::shared_ptr newClient( + std::shared_ptr newClient( const folly::SocketAddress& address, const std::chrono::milliseconds& transactionTimeout, const std::chrono::milliseconds& connectTimeout, bool useHttps, - std::shared_ptr pool, + std::shared_ptr pool, std::function&& reportOnBodyStatsFunc = nullptr) { - return std::make_shared( + return std::make_shared( eventBase_.get(), nullptr, proxygen::Endpoint( @@ -221,32 +222,33 @@ class HttpClientFactory { std::unique_ptr eventBaseThread_; }; -folly::SemiFuture> sendGet( - http::HttpClient* client, +folly::SemiFuture> +sendGet( + facebook::presto::http::HttpClient* client, const std::string& url, const uint64_t sendDelay = 0, const std::string body = "") { - return http::RequestBuilder() + return facebook::presto::http::RequestBuilder() .method(proxygen::HTTPMethod::GET) .url(url) .send(client, body, sendDelay); } -static std::unique_ptr getHttpServer( +static std::unique_ptr getHttpServer( bool useHttps, const std::shared_ptr& httpIOExecutor) { if (useHttps) { const std::string certPath = getCertsPath("test_cert1.pem"); const std::string keyPath = getCertsPath("test_key1.pem"); const std::string ciphers = "AES128-SHA,AES128-SHA256,AES256-GCM-SHA384"; - auto httpsConfig = std::make_unique( + auto httpsConfig = std::make_unique( folly::SocketAddress("127.0.0.1", 0), certPath, keyPath, ciphers); - return std::make_unique( + return std::make_unique( httpIOExecutor, nullptr, std::move(httpsConfig)); } else { - return std::make_unique( + return std::make_unique( httpIOExecutor, - std::make_unique( + std::make_unique( folly::SocketAddress("127.0.0.1", 0)), nullptr); } @@ -268,17 +270,18 @@ struct AsyncMsgRequestState { std::function customFunc; }; -http::EndpointRequestHandlerFactory asyncMsg( +facebook::presto::http::EndpointRequestHandlerFactory asyncMsg( std::shared_ptr request) { return [request]( proxygen::HTTPMessage* /* message */, const std::vector& /* args */) { - return new http::CallbackRequestHandler( + return new facebook::presto::http::CallbackRequestHandler( [request]( proxygen::HTTPMessage* /*message*/, const std::vector>& /*body*/, proxygen::ResponseHandler* downstream, - std::shared_ptr handlerState) { + std::shared_ptr + handlerState) { auto [promise, future] = folly::makePromiseContract(); auto eventBase = folly::EventBaseManager::get()->getEventBase(); auto maxWaitMillis = request->maxWaitMillis; @@ -297,7 +300,7 @@ http::EndpointRequestHandlerFactory asyncMsg( if (!handlerState->requestExpired()) { request->requestStatus = kStatusValid; proxygen::ResponseBuilder(downstream) - .status(http::kHttpOk, "") + .status(facebook::presto::http::kHttpOk, "") .header(proxygen::HTTP_HEADER_CONTENT_TYPE, "text/plain") .body(msg) .sendWithEOM(); @@ -311,7 +314,9 @@ http::EndpointRequestHandlerFactory asyncMsg( if (!handlerState->requestExpired()) { request->requestStatus = kStatusValid; proxygen::ResponseBuilder(downstream) - .status(http::kHttpInternalServerError, "") + .status( + facebook::presto::http::kHttpInternalServerError, + "") .header( proxygen::HTTP_HEADER_CONTENT_TYPE, "text/plain") .body(e.what()) diff --git a/presto-native-execution/presto_cpp/main/operators/BroadcastExchangeSource.cpp b/presto-native-execution/presto_cpp/main/operators/BroadcastExchangeSource.cpp index ee7b17f5ce571..e26574ba015d7 100644 --- a/presto-native-execution/presto_cpp/main/operators/BroadcastExchangeSource.cpp +++ b/presto-native-execution/presto_cpp/main/operators/BroadcastExchangeSource.cpp @@ -17,6 +17,8 @@ #include "presto_cpp/main/common/Configs.h" #include "presto_cpp/main/operators/BroadcastExchangeSource.h" +using namespace facebook::velox; + namespace facebook::presto::operators { namespace { diff --git a/presto-native-execution/presto_cpp/main/operators/BroadcastFactory.h b/presto-native-execution/presto_cpp/main/operators/BroadcastFactory.h index dfd03e8286e74..05656c656d575 100644 --- a/presto-native-execution/presto_cpp/main/operators/BroadcastFactory.h +++ b/presto-native-execution/presto_cpp/main/operators/BroadcastFactory.h @@ -18,8 +18,6 @@ #include "velox/vector/ComplexVector.h" #include "velox/vector/VectorStream.h" -using namespace facebook::velox; - namespace facebook::presto::operators { /// Struct for single broadcast file info.] @@ -48,7 +46,7 @@ class BroadcastFileWriter { virtual ~BroadcastFileWriter() = default; /// Write to file. - void collect(const RowVectorPtr& input); + void collect(const velox::RowVectorPtr& input); /// Flush the data. void noMoreData(); @@ -110,8 +108,8 @@ class BroadcastFactory { virtual ~BroadcastFactory() = default; std::unique_ptr createWriter( - memory::MemoryPool* pool, - const RowTypePtr& inputType); + velox::memory::MemoryPool* pool, + const velox::RowTypePtr& inputType); std::shared_ptr createReader( const std::unique_ptr fileInfo,