| 299 | } |
| 300 | |
| 301 | arrow::Result<std::shared_ptr<Schema>> FlightInfo::GetSchema( |
| 302 | ipc::DictionaryMemo* dictionary_memo) const { |
| 303 | if (reconstructed_schema_) { |
| 304 | return schema_; |
| 305 | } else if (data_.schema.empty()) { |
| 306 | reconstructed_schema_ = true; |
| 307 | return schema_; |
| 308 | } |
| 309 | // Create a non-owned Buffer to avoid copying |
| 310 | io::BufferReader schema_reader(std::make_shared<Buffer>(data_.schema)); |
| 311 | RETURN_NOT_OK(ipc::ReadSchema(&schema_reader, dictionary_memo).Value(&schema_)); |
| 312 | reconstructed_schema_ = true; |
| 313 | return schema_; |
| 314 | } |
| 315 | |
| 316 | arrow::Status FlightInfo::SerializeToString(std::string* out) const { |
| 317 | return SerializeToProtoString<pb::FlightInfo>("FlightInfo", *this, out); |