| 219 | } |
| 220 | |
| 221 | arrow::Result<int64_t> FlightSqlClient::ExecuteSubstraitUpdate( |
| 222 | const FlightCallOptions& options, const SubstraitPlan& plan, |
| 223 | const Transaction& transaction) { |
| 224 | flight_sql_pb::CommandStatementSubstraitPlan command; |
| 225 | SetPlan(plan, command.mutable_plan()); |
| 226 | if (transaction.is_valid()) { |
| 227 | command.set_transaction_id(transaction.transaction_id()); |
| 228 | } |
| 229 | |
| 230 | ARROW_ASSIGN_OR_RAISE(FlightDescriptor descriptor, |
| 231 | GetFlightDescriptorForCommand(command)); |
| 232 | |
| 233 | ARROW_ASSIGN_OR_RAISE(auto result, DoPut(options, descriptor, arrow::schema({}))); |
| 234 | |
| 235 | std::shared_ptr<Buffer> metadata; |
| 236 | ARROW_RETURN_NOT_OK(result.reader->ReadMetadata(&metadata)); |
| 237 | ARROW_RETURN_NOT_OK(result.writer->Close()); |
| 238 | |
| 239 | flight_sql_pb::DoPutUpdateResult update_result; |
| 240 | if (!update_result.ParseFromArray(metadata->data(), |
| 241 | static_cast<int>(metadata->size()))) { |
| 242 | return Status::Invalid("Unable to parse DoPutUpdateResult"); |
| 243 | } |
| 244 | |
| 245 | return update_result.record_count(); |
| 246 | } |
| 247 | |
| 248 | arrow::Result<int64_t> FlightSqlClient::ExecuteIngest( |
| 249 | const FlightCallOptions& options, const std::shared_ptr<RecordBatchReader>& reader, |