Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion google/cloud/bigquery_unified/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ StatusOr<google::cloud::bigquery::v2::Job> Client::GetJob(
Status Client::DeleteJob(
google::cloud::bigquery::v2::DeleteJobRequest const& request,
Options opts) {
return internal::UnimplementedError("not implemented");
return connection_->DeleteJob(
request, internal::MergeOptions(std::move(opts), options_));
}

StreamRange<google::cloud::bigquery::v2::ListFormatJob> Client::ListJobs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_F(JobIntegrationTest, GetJob) {
auto client = google::cloud::bigquery_unified::Client(connection);

// TODO: hard coding this id is brittle but currently necessary.
std::string const job_id = "job_TyRhPS6z-5_e9JSwtT8ieuwDOdLD";
std::string const job_id = "bquxjob_606db6e8_19465e708c7";
bigquery_proto::GetJobRequest get_request;
get_request.set_project_id(project_id_);
get_request.set_job_id(job_id);
Expand All @@ -50,6 +50,22 @@ TEST_F(JobIntegrationTest, GetJob) {
EXPECT_THAT(job->status().state(), Eq("DONE"));
}

TEST_F(JobIntegrationTest, DeleteJob) {
namespace bigquery_proto = google::cloud::bigquery::v2;
std::shared_ptr<Connection> connection =
google::cloud::bigquery_unified::MakeConnection();
auto client = google::cloud::bigquery_unified::Client(connection);

// TODO: hard coding this id is brittle but currently necessary.
std::string const job_id = "bquxjob_606db6e8_19465e708c7";

bigquery_proto::DeleteJobRequest delete_request;
delete_request.set_project_id(project_id_);
delete_request.set_job_id(job_id);
auto status = client.DeleteJob(delete_request);
ASSERT_STATUS_OK(status);
}

} // namespace
GOOGLE_CLOUD_CPP_BIGQUERY_INLINE_NAMESPACE_END
} // namespace google::cloud::bigquery_unified
10 changes: 10 additions & 0 deletions google/cloud/bigquery_unified/internal/connection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ StatusOr<google::cloud::bigquery::v2::Job> ConnectionImpl::GetJob(
return job_connection_->GetJob(request);
}

Status ConnectionImpl::DeleteJob(
google::cloud::bigquery::v2::DeleteJobRequest const& request,
Options opts) {
// TODO: Instead of creating an OptionsSpan, pass opts when job_connection_
// supports it.
internal::OptionsSpan span(internal::MergeOptions(
std::move(opts), internal::MergeOptions(options_, job_options_)));
return job_connection_->DeleteJob(request);
}

std::shared_ptr<bigquery_unified::Connection> MakeDefaultConnectionImpl(
Options options) {
auto job_options =
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/bigquery_unified/internal/connection_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class ConnectionImpl : public bigquery_unified::Connection {
google::cloud::bigquery::v2::GetJobRequest const& request,
Options opts) override;

Status DeleteJob(google::cloud::bigquery::v2::DeleteJobRequest const& request,
Options opts) override;

private:
std::shared_ptr<bigquerycontrol_v2::JobServiceConnection> job_connection_;
std::shared_ptr<bigquerycontrol_v2_internal::JobServiceRestStub> job_stub_;
Expand Down