You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/03 15:16:28 UTC

[GitHub] [arrow] rafael-telles commented on a change in pull request #11507: ARROW-14421: [C++] Implement Flight SQL

rafael-telles commented on a change in pull request #11507:
URL: https://github.com/apache/arrow/pull/11507#discussion_r762022080



##########
File path: cpp/src/arrow/flight/sql/server_test.cc
##########
@@ -123,24 +127,35 @@ class SqlInfoDenseUnionValidator {
   SqlInfoDenseUnionValidator& operator=(const SqlInfoDenseUnionValidator&) = delete;
 };
 
-std::unique_ptr<TestServer> server;
-std::unique_ptr<FlightSqlClient> sql_client;
+class TestFlightSqlServer : public ::testing::Test {
+ public:
+  std::unique_ptr<FlightSqlClient> sql_client;
+
+  arrow::Result<int64_t> ExecuteCountQuery(const std::string& query) {
+    ARROW_ASSIGN_OR_RAISE(auto flight_info, sql_client->Execute({}, query));
+
+    ARROW_ASSIGN_OR_RAISE(auto stream,
+                          sql_client->DoGet({}, flight_info->endpoints()[0].ticket));
+
+    std::shared_ptr<Table> table;
+    ARROW_RETURN_NOT_OK(stream->ReadAll(&table));
+
+    const std::shared_ptr<Array>& result_array = table->column(0)->chunk(0);
+    ARROW_ASSIGN_OR_RAISE(auto count_scalar, result_array->GetScalar(0));
+
+    return reinterpret_cast<Int64Scalar&>(*count_scalar).value;
+  }
 
-class TestFlightSqlServer : public ::testing::Environment {
  protected:
   void SetUp() override {
-    server.reset(new TestServer("flight_sql_test_server"));
-    server->Start();
-    for (int i = 0; i < 100; i++) {
-      std::this_thread::sleep_for(std::chrono::milliseconds(10));
-      if (server->IsRunning()) {
-        break;
-      }
-    }
-    ASSERT_TRUE(server->IsRunning());
+    unix_sock = std::tmpnam(nullptr);
+    server_thread.reset(new std::thread(RunServer, this));
+
+    std::unique_lock<std::mutex> lk(server_ready_m);
+    server_ready_cv.wait(lk);
 
     std::stringstream ss;
-    ss << "grpc://localhost:" << server->port();
+    ss << "grpc+unix://" << unix_sock;

Review comment:
       I see, reverted this to keep using TCP




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org