Skip to content

Commit 4da0d4a

Browse files
committed
Address more feedback
1 parent dd1db17 commit 4da0d4a

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ FlightStreamChunkBuffer::FlightStreamChunkBuffer(
4949
std::unique_ptr<FlightClient> temp_flight_client;
5050
util::ThrowIfNotOK(FlightClient::Connect(endpoint_locations[0], client_options)
5151
.Value(&temp_flight_client));
52-
temp_flight_sql_client.reset(new FlightSqlClient(std::move(temp_flight_client)));
52+
temp_flight_sql_client =
53+
std::make_shared<FlightSqlClient>(std::move(temp_flight_client));
5354

5455
result = temp_flight_sql_client->DoGet(call_options, ticket);
5556
}
@@ -67,6 +68,8 @@ FlightStreamChunkBuffer::FlightStreamChunkBuffer(
6768
// call. temp_flight_sql_client is intentionally null if the list of endpoint
6869
// Locations is empty.
6970
// After all data is fetched from reader, the temp client is closed.
71+
72+
// gh-48084 Replace boost::optional with std::optional
7073
return boost::make_optional(
7174
is_not_ok || is_not_empty,
7275
std::make_pair(std::move(result), temp_flight_sql_client));

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer_test.cc

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "arrow/flight/test_flight_server.h"
2525
#include "arrow/flight/test_util.h"
2626

27+
#include <gmock/gmock.h>
2728
#include <gtest/gtest.h>
2829

2930
namespace arrow::flight::sql::odbc {
@@ -92,17 +93,6 @@ FlightInfo MultipleEndpointsFlightInfo(Location location1, Location location2) {
9293
100000, false, "");
9394
}
9495

95-
void VerifyArraysContainIntsOnly(std::shared_ptr<Array> intArray) {
96-
for (int64_t i = 0; i < intArray->length(); ++i) {
97-
// null values are accepted
98-
if (!intArray->IsNull(i)) {
99-
auto scalar_data = intArray->GetScalar(i).ValueOrDie();
100-
std::string scalar_str = ConvertToJson(*scalar_data);
101-
ASSERT_TRUE(std::all_of(scalar_str.begin(), scalar_str.end(), ::isdigit));
102-
}
103-
}
104-
}
105-
10696
TEST_F(FlightStreamChunkBufferTest, TestMultipleEndpointsInt) {
10797
FlightClientOptions client_options = FlightClientOptions::Defaults();
10898
FlightCallOptions options;
@@ -127,7 +117,10 @@ TEST_F(FlightStreamChunkBufferTest, TestMultipleEndpointsInt) {
127117
// Each array has random length
128118
ASSERT_GT(array->length(), 0);
129119

130-
VerifyArraysContainIntsOnly(array);
120+
std::vector<int> int_types = {
121+
Type::type::INT8, Type::type::UINT8, Type::type::INT16, Type::type::UINT16,
122+
Type::type::INT32, Type::type::UINT32, Type::type::INT64, Type::type::UINT64};
123+
ASSERT_THAT(int_types, testing::Contains(array->type_id()));
131124
}
132125
}
133126

0 commit comments

Comments
 (0)