| 102 | } |
| 103 | |
| 104 | arrow::Result<GetSqlInfo> ParseCommandGetSqlInfo( |
| 105 | const google::protobuf::Any& any, const SqlInfoResultMap& sql_info_id_to_result) { |
| 106 | pb::sql::CommandGetSqlInfo command; |
| 107 | if (!any.UnpackTo(&command)) { |
| 108 | return Status::Invalid("Unable to unpack CommandGetSqlInfo."); |
| 109 | } |
| 110 | |
| 111 | GetSqlInfo result; |
| 112 | if (command.info_size() > 0) { |
| 113 | result.info.reserve(command.info_size()); |
| 114 | result.info.assign(command.info().begin(), command.info().end()); |
| 115 | } else { |
| 116 | result.info.reserve(sql_info_id_to_result.size()); |
| 117 | for (const auto& it : sql_info_id_to_result) { |
| 118 | result.info.push_back(it.first); |
| 119 | } |
| 120 | } |
| 121 | return result; |
| 122 | } |
| 123 | |
| 124 | arrow::Result<GetDbSchemas> ParseCommandGetDbSchemas(const google::protobuf::Any& any) { |
| 125 | pb::sql::CommandGetDbSchemas command; |