jduo commented on code in PR #34817: URL: https://github.com/apache/arrow/pull/34817#discussion_r1394963444
########## cpp/src/arrow/flight/types.cc: ########## @@ -468,6 +468,323 @@ 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; +} + +std::ostream& operator<<(std::ostream& os, const SetSessionOptionsResult::Result& r) { + os << '{' << r.status << '}'; + 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)) { Review Comment: Don't call count(k) here. Just call map.find(k) as you're doing at line 527 and check against b.end(). -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org