indigophox commented on code in PR #34817:
URL: https://github.com/apache/arrow/pull/34817#discussion_r1389876419
##########
cpp/src/arrow/flight/types.cc:
##########
@@ -463,6 +463,318 @@ arrow::Result<CancelFlightInfoRequest>
CancelFlightInfoRequest::Deserialize(
return out;
}
+std::ostream& operator<<(std::ostream& os, const SetSessionOptionStatus& r) {
+ os << SetSessionOptionStatusNames[static_cast<int>(r)];
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const CloseSessionStatus& r) {
+ os << CloseSessionStatusNames[static_cast<int>(r)];
+ return os;
+}
+
+// Helpers for stringifying maps containing various types
+std::ostream& operator<<(std::ostream& os, std::vector<std::string> v) {
+ os << '[';
+ std::string sep = "";
+ for (const auto& x : v) {
+ os << sep << '"' << x << '"';
+ sep = ", ";
+ }
+ os << ']';
+
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const SessionOptionValue& v) {
+ std::visit([&](const auto& x) { os << x; }, v);
+ return os;
+}
+
+template <typename T>
+std::ostream& operator<<(std::ostream& os, std::map<std::string, T> m) {
+ os << '{';
+ std::string sep = "";
+ for (const auto& [k, v] : m) {
+ os << sep << '[' << k << "]: '" << v;
+ sep = ", ";
+ }
+ os << '}';
+
+ return os;
+}
+
+namespace {
+static bool CompareSessionOptionMaps(const std::map<std::string,
SessionOptionValue>& a,
+ const std::map<std::string,
SessionOptionValue>& b) {
+ if (a.size() != b.size()) {
+ return false;
+ }
+ for (const auto& [k, v] : a) {
+ if (!b.count(k)) {
+ return false;
+ }
+ try {
+ const auto& b_v = b.at(k);
+ if (v.index() != b_v.index()) {
+ return false;
+ }
+ if (v != b_v) {
+ return false;
+ }
+ } catch (const std::out_of_range& e) {
+ return false;
+ }
Review Comment:
Done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]