Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-34865: [C++][Java][Flight RPC] Add Session management messages #34817

Merged
merged 195 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
7a41c5f
Add Session management messages, Location URI path accessors
jduo Dec 2, 2022
dbbc829
Address PR feedback
Apr 3, 2023
6738a49
Remove non-const references
Apr 16, 2023
7757c33
Add partial (some gaps) ServerSessionMiddleware impl
May 17, 2023
4d7e4a0
Initial StartCall impl, etc.
Jun 14, 2023
a6d2899
Prelim impl ServerSessionMWFactory locking
Jun 16, 2023
360f23b
Untested initial middleware impl
Jun 22, 2023
672a266
Rename lock_ and remove duplicitous comments
Jun 23, 2023
9194302
Make code build
Jun 23, 2023
888ff22
Fix server set-cookie header name
Jun 23, 2023
3326ad8
Remove/revert abandoned Location changes
Jun 28, 2023
6041b28
[BUILDS] Move Session messages to Flight PB
Jul 13, 2023
ad0afab
Change Proto to use map of Session options
Jul 14, 2023
66ad805
FSQL Client: Use SessionOptions PB Map
Jul 14, 2023
d6005a1
FSQL Server: Use SessionOptions PB Map (incomplete?)
Jul 14, 2023
55c198d
[Builds] Fix build errors
Jul 18, 2023
afbe366
[BUILDS] Use visitors to convert SessionOptionValue->Proto
Jul 24, 2023
0f8d8c0
Change to string_view for interfaces
Aug 10, 2023
bd8095c
WIP: High-level design review ONLY
Oct 22, 2023
7ede0b3
WIP: impl *::Deserialize()
Oct 30, 2023
d07c91c
WIP: ~finish flight/types.cc & serialization_internal.h
Oct 31, 2023
577ed91
WIP: Update some temporary comments
Oct 31, 2023
9414dc6
Impl FromProto(SessionOptionValue...)
Nov 1, 2023
7225a5e
Random WIP checkpoint
Nov 1, 2023
e2b4133
WIP: Finished serialization_internal.cc ?
Nov 1, 2023
5c85558
WIP: Remove 'Action' prefix from Proto messages
Nov 1, 2023
b5e37ac
Reduce long Proto nested enum names
Nov 1, 2023
6e7dff8
Indentation etc.
Nov 1, 2023
9d5d01f
Update to 'Status' enums in Proto
Nov 1, 2023
dea4a82
WIP: More replacement of Result with Status for enums
Nov 1, 2023
0620d38
WIP: Even more replacement of Result with Status for enums
Nov 1, 2023
15f5bf7
WIP: Even MORE replacement of Result with Status for enums
Nov 1, 2023
a6d60f1
Formatting & remove erroneous 'static'
Nov 1, 2023
433d9bc
Typos
Nov 1, 2023
e9e796a
Add new SetSessionOption statuses to Proto
Nov 1, 2023
f8d0e72
Fixup flight/client.*
Nov 1, 2023
001ab4a
Fix name change + remove temporary comments
Nov 1, 2023
071c42f
Move lambda overload helpers around & other cleanup
Nov 1, 2023
abfbec6
Fixed all but 1 build error
Nov 2, 2023
c234edd
Fix last build issue
Nov 2, 2023
01fdb18
[builds] Remote extraneous comments
Nov 2, 2023
1f2262c
[builds] Some PR fixups
Nov 2, 2023
69f35ec
[builds] More PR feedback
Nov 2, 2023
5b2cee7
[builds] More PR feedback
Nov 2, 2023
2affc0b
[builds] Fix linter errors
Nov 2, 2023
8c3aac9
[builds] clang-format
Nov 2, 2023
1eaf15a
[builds] Add missing include
Nov 2, 2023
6a53fba
[builds] Fix clang-format{14,17} differences
Nov 3, 2023
91c9e17
[builds] Add missed change from previous
Nov 3, 2023
16d8506
[builds] C++ docs fixup
Nov 3, 2023
3f4b6a2
Add Protobuf docstrings & rename Flight session cookie
Nov 3, 2023
d0f383c
[builds] Remove unused Proto import
Nov 3, 2023
29d12dd
Fixes for @stevelorddremio's feedback
Nov 9, 2023
cbe3478
Revert extraneous linter changes
Nov 9, 2023
f391ea9
More PR feedback resolution
Nov 9, 2023
df0652b
More PR feedback
Nov 10, 2023
ad6ffd3
More PR feedback
Nov 10, 2023
14ee82d
[builds] More PR fixups
Nov 10, 2023
c541924
PR feedback
Nov 10, 2023
98e2234
PR feedback
Nov 10, 2023
345c2be
PR feedback
Nov 10, 2023
45e1f7c
Refactor to facilitate proper make_shared
Nov 10, 2023
992d9f0
[builds] Finish refactor to use map.find()
Nov 10, 2023
75d0c4e
Remove extraneous using namespace
Nov 10, 2023
13afc00
[builds] Factor out session ID generation & remove Boost
Nov 10, 2023
b56f21d
[builds] make GetNewSession return std::pair
Nov 10, 2023
20acab6
[builds] Fix argument forwarding for FlightSqlSession::SetSessionOption
Nov 10, 2023
76c21f5
[builds] Docs fixup
Nov 10, 2023
a9c45cf
[builds] move SetSessionOptionsResult status to estensible nested msg
Nov 15, 2023
498867b
[builds] Remove Result<> wrapper from GetSessionOption
Nov 15, 2023
457ebf2
[builds] PR feedback fixups
Nov 15, 2023
8ea8911
[builds] PR feedback fixups
Nov 15, 2023
dfccca7
[builds] Add virtual default destructor to ServerSessionMiddleware
Nov 15, 2023
41c04be
[builds] Fix CI linter issues.
Nov 15, 2023
411203c
[builds] Fix abstract subclass ServerSessionMiddleware.
Nov 15, 2023
4117a4f
[builds] WHOOPS: Fix tangled/redundant Session ActionTypes
Nov 15, 2023
c33d4cb
[builds] CI fixups
Nov 16, 2023
5cc856b
[builds] Remove redundant branch
Nov 16, 2023
a0f9e5f
[builds] Fix reader/writer locks
Nov 17, 2023
baef34a
[builds] Remove extraneous include
Nov 17, 2023
f349a34
Apply @kou suggestions from code review
indigophox Nov 17, 2023
a622032
[builds] More @kou feedback integrated
Nov 17, 2023
54175aa
[builds] Fix docs
Nov 20, 2023
722db0f
[builds] PR feedback
Nov 21, 2023
66310eb
[builds] Return {"",NULLPTR} on id generation collision
Nov 21, 2023
e1a62fa
[builds] linter
Nov 21, 2023
71c1082
[builds] copy to proto repeated string value using iterator
Nov 21, 2023
0163d6e
[builds] (partial?) fix for ParseCookieString, pending testing
Nov 21, 2023
4e541f7
[builds] fixup
Nov 21, 2023
4a3ea95
[builds] fixup
Nov 21, 2023
f29ea91
[builds] grrrr CI grrrr
Nov 21, 2023
4b9c13d
[builds] Revert iterator-copy not supported by CI PB libs
Nov 21, 2023
8bc0de5
Add some testing
Nov 22, 2023
3b82b7a
oops
Nov 22, 2023
6d48c72
grrr linter
Nov 22, 2023
bb52798
grrr linter
Nov 22, 2023
9230573
grrrr linter
Nov 22, 2023
02b5998
grrrr linter
Nov 23, 2023
01fd559
[builds] Remove extraneous SessionOptions type tests
Nov 23, 2023
28c9b31
Typo fix
Nov 29, 2023
44cb613
[Java WIP] Add ActionTypes & some SessionOptionValue types
Nov 29, 2023
7e5b5c2
+some docs
Nov 29, 2023
b6eca04
+some docs
Nov 29, 2023
8d72dde
+some docs
Nov 29, 2023
35852fd
Add some partially/fully implemented POJO message types
Dec 1, 2023
5de1455
Add method skeleton
Dec 2, 2023
67b1a7f
WIP: Java: add serde + POJO classes
Dec 6, 2023
b788119
Fixup
Dec 6, 2023
c152ec2
Change SetSessionOptionResult (Proto) to error-only behaviour
Dec 8, 2023
2f174f0
[builds] Update C++ to error-only SetSessionOptionsResult
Dec 8, 2023
1e79b9c
WIP: pseudo-complete Java impl
Dec 9, 2023
31ceb71
Fix some checkstyle errors
Dec 9, 2023
ebca8c2
Fix some more checkstyle errors
Dec 9, 2023
a73e8d2
checkpoint
Dec 10, 2023
fa73314
checkpoint
Dec 10, 2023
e6406cb
checkpoint - should be working but...
Dec 10, 2023
50bb521
[builds] Prelim Java implementation
Dec 10, 2023
e58742e
[builds] Prelim Java implementation
Dec 10, 2023
bc22b80
[Java WIP]: Add nullable SessionOptionValue
Dec 12, 2023
0df83a6
fixup
Dec 12, 2023
09c4369
[C++][builds] Add unset SessionOptionValue functionality
Dec 12, 2023
03da012
[C++ builds][Java builds] typos/etc
Dec 12, 2023
2bcc721
Add Proto comment re: nullability
Dec 12, 2023
93e974c
[C++][builds] Add braces
Dec 13, 2023
479300a
[C++][builds] Tiny refactor
Dec 13, 2023
57f5ed3
Update Proto comments re: HTTP-cookies-or-similar
Dec 13, 2023
90f1f81
checkpoint
Dec 14, 2023
c8ee267
[Java builds] fixups
Dec 18, 2023
5b587db
[Java builds] Add ServerSessionMiddleware.java
Dec 18, 2023
23e71c3
Fixup
Dec 23, 2023
f90f09e
checkpoint
Jan 2, 2024
f9afd1c
checkpoint
Jan 2, 2024
6d3f2c0
checkpoint
Jan 3, 2024
6d77693
checkpoint
Jan 3, 2024
a00cf2a
[Java builds] Add initial Java integration tests
Jan 3, 2024
f473c79
[C++] clang-format fixups
Jan 3, 2024
55c200b
[C++] clang-format fixup
Jan 3, 2024
5e1306a
[Java builds] Add and fix initial working Java integration test
Jan 5, 2024
cceff95
[Java builds] Expand SessionOptionsProducer to facilitate more tests
Jan 10, 2024
e4ea62f
WIP
Jan 11, 2024
91337d8
checkpoint
Jan 11, 2024
261be03
[Java builds & passes] fix up integration tests & related code
Jan 11, 2024
e171643
[Java builds & passes] Fix & add Unicode integration test coverage
Jan 11, 2024
ca2a1e4
[Java builds & passes] ServerSessionMiddleware.CloseSession: expire c…
Jan 11, 2024
cf5f74f
[Java builds & passes] Finish Java integration tests
Jan 12, 2024
0baa248
[C++ builds] Factor ServerSessionMiddleware to separate header for te…
Jan 12, 2024
c7975ec
[temp] Add dummy C++ unit test
Jan 15, 2024
e17d0db
[temp][fixup] Add dummy C++ unit test
Jan 15, 2024
55c6864
[temp][linter fixup] Add dummy C++ unit test
Jan 15, 2024
c7f7dec
Fix Java build errors & dependencies
Jan 15, 2024
a200fea
[Java builds][C++ builds] Extricate int32 & float
Jan 16, 2024
62bc378
[Java builds][C++ builds] Add NoOpSessionOptionValueVisitor
Jan 16, 2024
82bc842
Test adding Flight C++ unit test
Jan 16, 2024
1e45e44
Test #2 adding Flight C++ unit test
Jan 16, 2024
9630c13
Test #3 adding Flight C++ unit test
Jan 16, 2024
59001cf
Test #4 adding Flight C++ unit test
Jan 16, 2024
24efb90
Test #5 adding Flight C++ unit test
Jan 16, 2024
e69c7ec
[C++ builds] added tautological failure to arrow-flight-sql-test
Jan 16, 2024
9e48793
[C++ builds] Add C++ ServerSessionMiddleware cookie parsing test
Jan 17, 2024
b68800d
[C++ builds] Probably fix Win64 C++ CI build linker error
Jan 19, 2024
6cd8ce6
Revert "[C++ builds] Probably fix Win64 C++ CI build linker error"
Jan 19, 2024
dbce9ce
[C++ builds] CI linter fixups
Jan 20, 2024
f11e997
[C++ builds] Linter + linker fixups
Jan 20, 2024
ec26615
[Docs] Doc fixup
Jan 20, 2024
565a79c
[C++ builds][Java builds] PR feedback etc
Jan 21, 2024
82be14d
Guessed workaround for opaque CMake linter error
Jan 21, 2024
6d27c34
Remove extraneous whitespace in CMakeLists.txt
Jan 21, 2024
39e21a7
[C++ builds] checkpoint
Jan 22, 2024
4134aa0
[C++ builds] checkpoint
Jan 22, 2024
b5bf2ab
[C++ builds] checkpoint
Jan 22, 2024
26ffb8a
[C++ builds] checkpoint
Jan 22, 2024
0f8fae3
[C++ builds] BUG CHECKPOINT
Jan 22, 2024
028f0a5
[C++ builds] Add session cookie expiry
Jan 22, 2024
95d0499
[Java builds] Fix NoOpSessionOptionValueVisitor iface
Jan 23, 2024
e83c8bb
[C++ builds & passes] Bodge around middleware gap
Jan 24, 2024
3904ce7
[C++ builds] remove debug spew
Jan 24, 2024
1b6840f
[C++ builds & passes] Update middleware & tests
Jan 24, 2024
61a2a3f
[C++ builds & passes] CI linter fixups
Jan 24, 2024
5f60981
Docstring
Jan 24, 2024
9f6c024
Fix CMake lint error
Jan 24, 2024
91fb77d
[Java builds & passes] Remove Java integration tests that won't work …
Jan 29, 2024
4aa5b3c
Add docs
Jan 29, 2024
20286a1
Add session_options to Archery integration testing
Jan 29, 2024
b71edf5
Fix imports
Jan 29, 2024
1078d47
Exclude session_options go test
Jan 29, 2024
07ac419
Docs touchup
Jan 29, 2024
270c152
[Builds & passes] naming consistency fix
Jan 30, 2024
a1d19dc
[Builds & passes] Docstring fixups
Jan 30, 2024
33d66c4
Address PR feedback
Feb 5, 2024
591281a
Update Protobuf enum comments
Feb 5, 2024
58381ba
Linter fixups & rebase
Feb 5, 2024
042a193
Factor out addMiddlewareHeaders
Feb 10, 2024
60c1298
Refactor GrpcServiceHandler::GetFlightInfo() to use addMiddlewareHead…
Feb 10, 2024
f80b941
PR feedback
Feb 15, 2024
265e5e8
PR feedback
Feb 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions cpp/src/arrow/flight/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,47 @@ arrow::Result<FlightClient::DoExchangeResult> FlightClient::DoExchange(
return result;
}

::arrow::Result<SetSessionOptionsResult> FlightClient::SetSessionOptions(
const FlightCallOptions& options, const SetSessionOptionsRequest& request) {
RETURN_NOT_OK(CheckOpen());
ARROW_ASSIGN_OR_RAISE(auto body, request.SerializeToString());
Action action{ActionType::kSetSessionOptions.type, Buffer::FromString(body)};
ARROW_ASSIGN_OR_RAISE(auto stream, DoAction(options, action));
ARROW_ASSIGN_OR_RAISE(auto result, stream->Next());
ARROW_ASSIGN_OR_RAISE(
auto set_session_options_result,
SetSessionOptionsResult::Deserialize(std::string_view(*result->body)));
ARROW_RETURN_NOT_OK(stream->Drain());
return set_session_options_result;
}

::arrow::Result<GetSessionOptionsResult> FlightClient::GetSessionOptions(
const FlightCallOptions& options, const GetSessionOptionsRequest& request) {
RETURN_NOT_OK(CheckOpen());
ARROW_ASSIGN_OR_RAISE(auto body, request.SerializeToString());
Action action{ActionType::kGetSessionOptions.type, Buffer::FromString(body)};
ARROW_ASSIGN_OR_RAISE(auto stream, DoAction(options, action));
ARROW_ASSIGN_OR_RAISE(auto result, stream->Next());
ARROW_ASSIGN_OR_RAISE(
auto get_session_options_result,
GetSessionOptionsResult::Deserialize(std::string_view(*result->body)));
ARROW_RETURN_NOT_OK(stream->Drain());
return get_session_options_result;
}

::arrow::Result<CloseSessionResult> FlightClient::CloseSession(
const FlightCallOptions& options, const CloseSessionRequest& request) {
RETURN_NOT_OK(CheckOpen());
ARROW_ASSIGN_OR_RAISE(auto body, request.SerializeToString());
Action action{ActionType::kCloseSession.type, Buffer::FromString(body)};
ARROW_ASSIGN_OR_RAISE(auto stream, DoAction(options, action));
ARROW_ASSIGN_OR_RAISE(auto result, stream->Next());
ARROW_ASSIGN_OR_RAISE(auto close_session_result,
CloseSessionResult::Deserialize(std::string_view(*result->body)));
ARROW_RETURN_NOT_OK(stream->Drain());
return close_session_result;
}

Status FlightClient::Close() {
if (!closed_) {
closed_ = true;
Expand Down
21 changes: 21 additions & 0 deletions cpp/src/arrow/flight/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,27 @@ class ARROW_FLIGHT_EXPORT FlightClient {
return DoExchange({}, descriptor);
}

/// \brief Set server session option(s) by name/value. Sessions are generally
/// persisted via HTTP cookies.
/// \param[in] options Per-RPC options
/// \param[in] request The server session options to set
::arrow::Result<SetSessionOptionsResult> SetSessionOptions(
const FlightCallOptions& options, const SetSessionOptionsRequest& request);

/// \brief Get the current server session options. The session is generally
/// accessed via an HTTP cookie.
/// \param[in] options Per-RPC options
/// \param[in] request The (empty) GetSessionOptions request object.
::arrow::Result<GetSessionOptionsResult> GetSessionOptions(
const FlightCallOptions& options, const GetSessionOptionsRequest& request);
indigophox marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Close/invalidate the current server session. The session is generally
/// accessed via an HTTP cookie.
/// \param[in] options Per-RPC options
/// \param[in] request The (empty) CloseSession request object.
::arrow::Result<CloseSessionResult> CloseSession(const FlightCallOptions& options,
const CloseSessionRequest& request);
indigophox marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Explicitly shut down and clean up the client.
///
/// For backwards compatibility, this will be implicitly called by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ TEST(FlightIntegration, ExpirationTimeRenewFlightEndpoint) {
ASSERT_OK(RunScenario("expiration_time:renew_flight_endpoint"));
}

TEST(FlightIntegration, SessionOptions) { ASSERT_OK(RunScenario("session_options")); }

TEST(FlightIntegration, PollFlightInfo) { ASSERT_OK(RunScenario("poll_flight_info")); }

TEST(FlightIntegration, AppMetadataFlightInfoEndpoint) {
Expand Down
154 changes: 154 additions & 0 deletions cpp/src/arrow/flight/integration_tests/test_integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
#include "arrow/array/array_nested.h"
#include "arrow/array/array_primitive.h"
#include "arrow/array/builder_primitive.h"
#include "arrow/flight/client_cookie_middleware.h"
#include "arrow/flight/client_middleware.h"
#include "arrow/flight/server_middleware.h"
#include "arrow/flight/sql/client.h"
#include "arrow/flight/sql/column_metadata.h"
#include "arrow/flight/sql/server.h"
#include "arrow/flight/sql/server_session_middleware.h"
#include "arrow/flight/sql/types.h"
#include "arrow/flight/test_util.h"
#include "arrow/flight/types.h"
Expand Down Expand Up @@ -744,6 +746,155 @@ class ExpirationTimeRenewFlightEndpointScenario : public Scenario {
}
};

/// \brief The server used for testing Session Options.
///
/// SetSessionOptions has a blacklisted option name and string option value,
/// both "lol_invalid", which will result in errors attempting to set either.
class SessionOptionsServer : public sql::FlightSqlServerBase {
static inline const std::string invalid_option_name = "lol_invalid";
static inline const SessionOptionValue invalid_option_value = "lol_invalid";

const std::string session_middleware_key;
// These will never be threaded so using a plain map and no lock
std::map<std::string, SessionOptionValue> session_store_;

public:
explicit SessionOptionsServer(std::string session_middleware_key)
: FlightSqlServerBase(),
session_middleware_key(std::move(session_middleware_key)) {}

arrow::Result<SetSessionOptionsResult> SetSessionOptions(
const ServerCallContext& context,
const SetSessionOptionsRequest& request) override {
SetSessionOptionsResult res;

auto* middleware = static_cast<sql::ServerSessionMiddleware*>(
context.GetMiddleware(session_middleware_key));
ARROW_ASSIGN_OR_RAISE(std::shared_ptr<sql::FlightSession> session,
middleware->GetSession());

for (const auto& [name, value] : request.session_options) {
// Blacklisted value name
if (name == invalid_option_name) {
res.errors.emplace(name, SetSessionOptionsResult::Error{
SetSessionOptionErrorValue::kInvalidName});
continue;
}
// Blacklisted option value
if (value == invalid_option_value) {
res.errors.emplace(name, SetSessionOptionsResult::Error{
SetSessionOptionErrorValue::kInvalidValue});
continue;
}
if (std::holds_alternative<std::monostate>(value)) {
session->EraseSessionOption(name);
continue;
}
session->SetSessionOption(name, value);
}

return res;
}

arrow::Result<GetSessionOptionsResult> GetSessionOptions(
const ServerCallContext& context,
const GetSessionOptionsRequest& request) override {
auto* middleware = static_cast<sql::ServerSessionMiddleware*>(
context.GetMiddleware(session_middleware_key));
if (!middleware->HasSession()) {
return Status::Invalid("No existing session to get options from.");
}
ARROW_ASSIGN_OR_RAISE(std::shared_ptr<sql::FlightSession> session,
middleware->GetSession());

return GetSessionOptionsResult{session->GetSessionOptions()};
}

arrow::Result<CloseSessionResult> CloseSession(
const ServerCallContext& context, const CloseSessionRequest& request) override {
// Broken (does not expire cookie) until C++ middleware handling (GH-39791) fixed:
auto* middleware = static_cast<sql::ServerSessionMiddleware*>(
context.GetMiddleware(session_middleware_key));
ARROW_RETURN_NOT_OK(middleware->CloseSession());
return CloseSessionResult{CloseSessionStatus::kClosed};
}
};

/// \brief The Session Options scenario.
///
/// This tests Session Options functionality as well as ServerSessionMiddleware.
class SessionOptionsScenario : public Scenario {
static inline const std::string server_middleware_key = "sessionmiddleware";

Status MakeServer(std::unique_ptr<FlightServerBase>* server,
FlightServerOptions* options) override {
*server = std::make_unique<SessionOptionsServer>(server_middleware_key);

auto id_gen_int = std::make_shared<std::atomic_int>(1000);
options->middleware.emplace_back(
server_middleware_key,
sql::MakeServerSessionMiddlewareFactory(
[=]() -> std::string { return std::to_string((*id_gen_int)++); }));

return Status::OK();
}

Status MakeClient(FlightClientOptions* options) override {
options->middleware.emplace_back(GetCookieFactory());
return Status::OK();
}

Status RunClient(std::unique_ptr<FlightClient> flight_client) override {
sql::FlightSqlClient client{std::move(flight_client)};

// Set
auto req1 = SetSessionOptionsRequest{
{{"foolong", 123L},
{"bardouble", 456.0},
{"lol_invalid", "this won't get set"},
{"key_with_invalid_value", "lol_invalid"},
{"big_ol_string_list", std::vector<std::string>{"a", "b", "sea", "dee", " ",
" ", "geee", "(づ。◕‿‿◕。)づ"}}}};
ARROW_ASSIGN_OR_RAISE(auto res1, client.SetSessionOptions({}, req1));
// Some errors
if (res1.errors !=
std::map<std::string, SetSessionOptionsResult::Error>{
{"lol_invalid",
SetSessionOptionsResult::Error{SetSessionOptionErrorValue::kInvalidName}},
{"key_with_invalid_value", SetSessionOptionsResult::Error{
SetSessionOptionErrorValue::kInvalidValue}}}) {
return Status::Invalid("res1 incorrect: " + res1.ToString());
}
// Some set, some omitted due to above errors
ARROW_ASSIGN_OR_RAISE(auto res2, client.GetSessionOptions({}, {}));
if (res2.session_options !=
std::map<std::string, SessionOptionValue>{
{"foolong", 123L},
{"bardouble", 456.0},
{"big_ol_string_list",
std::vector<std::string>{"a", "b", "sea", "dee", " ", " ", "geee",
"(づ。◕‿‿◕。)づ"}}}) {
return Status::Invalid("res2 incorrect: " + res2.ToString());
}
// Update
ARROW_ASSIGN_OR_RAISE(
auto res3,
client.SetSessionOptions(
{}, SetSessionOptionsRequest{
{{"foolong", std::monostate{}},
{"big_ol_string_list", "a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ"}}}));
ARROW_ASSIGN_OR_RAISE(auto res4, client.GetSessionOptions({}, {}));
if (res4.session_options !=
std::map<std::string, SessionOptionValue>{
{"bardouble", 456.0},
{"big_ol_string_list", "a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ"}}) {
return Status::Invalid("res4 incorrect: " + res4.ToString());
}

return Status::OK();
}
};

/// \brief The server used for testing PollFlightInfo().
class PollFlightInfoServer : public FlightServerBase {
public:
Expand Down Expand Up @@ -1952,6 +2103,9 @@ Status GetScenario(const std::string& scenario_name, std::shared_ptr<Scenario>*
} else if (scenario_name == "expiration_time:renew_flight_endpoint") {
*out = std::make_shared<ExpirationTimeRenewFlightEndpointScenario>();
return Status::OK();
} else if (scenario_name == "session_options") {
*out = std::make_shared<SessionOptionsScenario>();
return Status::OK();
} else if (scenario_name == "poll_flight_info") {
*out = std::make_shared<PollFlightInfoScenario>();
return Status::OK();
Expand Down
Loading
Loading