MCPcopy Create free account
hub / github.com/apache/arrow / ExecuteUpdate

Method ExecuteUpdate

cpp/src/arrow/flight/sql/client.cc:193–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193arrow::Result<int64_t> FlightSqlClient::ExecuteUpdate(const FlightCallOptions& options,
194 const std::string& query,
195 const Transaction& transaction) {
196 flight_sql_pb::CommandStatementUpdate command;
197 command.set_query(query);
198 if (transaction.is_valid()) {
199 command.set_transaction_id(transaction.transaction_id());
200 }
201
202 ARROW_ASSIGN_OR_RAISE(FlightDescriptor descriptor,
203 GetFlightDescriptorForCommand(command));
204
205 ARROW_ASSIGN_OR_RAISE(auto result, DoPut(options, descriptor, arrow::schema({})))
206 std::shared_ptr<Buffer> metadata;
207 ARROW_RETURN_NOT_OK(result.reader->ReadMetadata(&metadata));
208 ARROW_RETURN_NOT_OK(result.writer->Close());
209
210 if (!metadata) return Status::IOError("Server did not send a response");
211
212 flight_sql_pb::DoPutUpdateResult update_result;
213 if (!update_result.ParseFromArray(metadata->data(),
214 static_cast<int>(metadata->size()))) {
215 return Status::Invalid("Unable to parse DoPutUpdateResult");
216 }
217
218 return update_result.record_count();
219}
220
221arrow::Result<int64_t> FlightSqlClient::ExecuteSubstraitUpdate(
222 const FlightCallOptions& options, const SubstraitPlan& plan,

Callers 5

ValidateTransactionsMethod · 0.45
acero_test.ccFile · 0.45
TEST_FFunction · 0.45

Calls 7

IOErrorFunction · 0.85
InvalidFunction · 0.50
is_validMethod · 0.45
ReadMetadataMethod · 0.45
CloseMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by 2

ValidateTransactionsMethod · 0.36
TEST_FFunction · 0.36