Skip to content

Commit 95fd46f

Browse files
committed
impl(bigquery): use fluent RPC setters
Use set_parent and set_read_session directly on CreateReadSession instead of building CreateReadSessionRequest separately. Towards googleapis#7039
1 parent a0b121e commit 95fd46f

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎src/bigquery/src/query/storage_reader.rs‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::RequestOptions;
1616
use crate::client::Read as ReadClient;
1717
use crate::error::RowError;
1818
use crate::model::{
19-
ArrowSerializationOptions, CreateReadSessionRequest, DataFormat, ReadRowsResponse, ReadSession,
19+
ArrowSerializationOptions, DataFormat, ReadRowsResponse, ReadSession,
2020
arrow_serialization_options::CompressionCodec, read_rows_response::Rows,
2121
read_rows_response::Schema as ReadRowsResponseSchema,
2222
read_session::Schema as ReadSessionSchema, read_session::TableReadOptions,
@@ -181,7 +181,9 @@ pub(crate) async fn try_create_read_session(
181181
dest_table.project_id, dest_table.dataset_id, dest_table.table_id
182182
);
183183

184-
let session_req = CreateReadSessionRequest::new()
184+
let session = read_client
185+
.create_read_session()
186+
.with_options(options.clone())
185187
.set_parent(format!("projects/{}", job_ref.project_id))
186188
.set_read_session(
187189
ReadSession::new()
@@ -193,12 +195,7 @@ pub(crate) async fn try_create_read_session(
193195
.set_buffer_compression(CompressionCodec::Lz4Frame),
194196
),
195197
),
196-
);
197-
198-
let session = read_client
199-
.create_read_session()
200-
.with_options(options.clone())
201-
.with_request(session_req)
198+
)
202199
.send()
203200
.await?;
204201

0 commit comments

Comments
 (0)