@@ -59,37 +59,36 @@ FlightStreamChunkBuffer::FlightStreamChunkBuffer(
5959 util::ThrowIfNotOK (result.status ());
6060 std::shared_ptr<FlightStreamReader> stream_reader_ptr (std::move (result.ValueOrDie ()));
6161
62- BlockingQueue<std::optional<
63- std::pair<Result<FlightStreamChunk>, std::shared_ptr<FlightSqlClient>>>>::Supplier
64- supplier = [=] {
65- auto result = stream_reader_ptr->Next ();
66- bool is_not_ok = !result.ok ();
67- bool is_not_empty = result.ok () && (result.ValueOrDie ().data != nullptr );
68-
69- // If result is valid, save the temp Flight SQL Client for future stream reader
70- // call. temp_flight_sql_client is intentionally null if the list of endpoint
71- // Locations is empty.
72- // After all data is fetched from reader, the temp client is closed.
73- if (is_not_ok || is_not_empty) {
74- return std::make_optional (
75- std::make_pair (std::move (result), temp_flight_sql_client));
76- } else {
77- return std::optional<
78- std::pair<Result<FlightStreamChunk>, std::shared_ptr<FlightSqlClient>>>{};
79- }
80- };
62+ BlockingQueue<std::pair<Result<FlightStreamChunk>,
63+ std::shared_ptr<FlightSqlClient>>>::Supplier supplier = [=] {
64+ auto result = stream_reader_ptr->Next ();
65+ bool is_not_ok = !result.ok ();
66+ bool is_not_empty = result.ok () && (result.ValueOrDie ().data != nullptr );
67+
68+ // If result is valid, save the temp Flight SQL Client for future stream reader
69+ // call. temp_flight_sql_client is intentionally null if the list of endpoint
70+ // Locations is empty.
71+ // After all data is fetched from reader, the temp client is closed.
72+ if (is_not_ok || is_not_empty) {
73+ return std::make_optional (
74+ std::make_pair (std::move (result), temp_flight_sql_client));
75+ } else {
76+ return std::optional<
77+ std::pair<Result<FlightStreamChunk>, std::shared_ptr<FlightSqlClient>>>{};
78+ }
79+ };
8180 queue_.AddProducer (std::move (supplier));
8281 }
8382}
8483
8584bool FlightStreamChunkBuffer::GetNext (FlightStreamChunk* chunk) {
86- std::optional<std:: pair<Result<FlightStreamChunk>, std::shared_ptr<FlightSqlClient> >>
85+ std::pair<Result<FlightStreamChunk>, std::shared_ptr<FlightSqlClient>>
8786 closeable_endpoint_stream_pair;
8887 if (!queue_.Pop (&closeable_endpoint_stream_pair)) {
8988 return false ;
9089 }
9190
92- Result<FlightStreamChunk> result = closeable_endpoint_stream_pair.value (). first ;
91+ Result<FlightStreamChunk> result = closeable_endpoint_stream_pair.first ;
9392 if (!result.status ().ok ()) {
9493 Close ();
9594 throw DriverException (result.status ().message ());
0 commit comments