indigophox commented on code in PR #34817:
URL: https://github.com/apache/arrow/pull/34817#discussion_r1156256082


##########
cpp/src/arrow/flight/sql/server.cc:
##########
@@ -359,6 +370,66 @@ arrow::Result<ActionEndTransactionRequest> 
ParseActionEndTransactionRequest(
   return result;
 }
 
+arrow::Result<ActionSetSessionOptionsRequest> 
ParseActionSetSessionOptionsRequest(
+    const google::protobuf::Any& any) {
+  pb::sql::ActionSetSessionOptionsRequest command;
+  if (!any.UnpackTo(&command)) {
+    return Status::Invalid("Unable to unpack ActionSetSessionOptionsRequest");
+  }
+
+  ActionSetSessionOptionsRequest result;
+  if (command.session_options_size() > 0) {
+    result.session_options.reserve(command.session_options_size());
+    for (const pb::sql::SessionOption& in_opt : command.session_options()) {
+      const std::string& name = in_opt.option_name();
+      SessionOption opt;
+      switch (in_opt.option_value_case()) {
+        case pb::sql::SessionOption::OPTION_VALUE_NOT_SET:
+          return Status::Invalid("Unset SessionOptionValue for name '" + name 
+ "'");
+        case pb::sql::SessionOption::kStringValue:
+          opt = {name, in_opt.string_value()};
+          break;
+        case pb::sql::SessionOption::kBoolValue:
+          opt = {name, in_opt.bool_value()};
+          break;
+        case pb::sql::SessionOption::kInt32Value:
+          opt = {name, in_opt.int32_value()};
+          break;
+        case pb::sql::SessionOption::kInt64Value:
+          opt = {name, in_opt.int64_value()};
+          break;
+        case pb::sql::SessionOption::kFloatValue:
+          opt = {name, in_opt.float_value()};
+          break;
+        case pb::sql::SessionOption::kDoubleValue:
+          opt = {name, in_opt.double_value()};
+          break;
+        case pb::sql::SessionOption::kStringListValue:
+          std::vector<std::string> vlist;
+          vlist.reserve(in_opt.string_list_value().values_size());
+          for (const std::string& s : in_opt.string_list_value().values())
+            vlist.push_back(s);
+          opt = {name, vlist};
+          break;
+      }
+      result.session_options.push_back(opt);

Review Comment:
   emplace_back requires we have a constructor which isn't out of the 
question—you think adding that is the better path then?



-- 
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]

Reply via email to