Skip to content
Draft
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
118 changes: 91 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ members = [
"src/bigquery",
"src/bigquery-derive",
"src/bigquery-read",
"src/bigquery/benchmarks/arrow_jobs_query",
"src/bigquery/examples",
"src/bigquery/grpc-mock",
"src/bigtable",
Expand Down Expand Up @@ -605,6 +606,7 @@ storage-grpc-mock = { path = "src/storage/grpc-mock" }

[workspace.lints.rust]
unexpected_cfgs = { level = "deny", check-cfg = [
'cfg(google_cloud_unstable_bigquery_arrow)',
'cfg(google_cloud_unstable_gapic_streaming)',
'cfg(google_cloud_unstable_grpc_rust)',
'cfg(google_cloud_unstable_grpc_server_streaming)',
Expand Down
21 changes: 21 additions & 0 deletions src/bigquery-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ pub fn derive_from_sql(input: TokenStream) -> TokenStream {
let field_idents_struct_obj = fields
.iter()
.map(|f| f.ident.as_ref().expect("named field must have identifier"));
let field_idents_struct_arrow = fields
.iter()
.map(|f| f.ident.as_ref().expect("named field must have identifier"));

let field_extractions_array = fields.iter().map(|f| {
let field_name = f.ident.as_ref().expect("named field must have identifier");
Expand All @@ -133,6 +136,14 @@ pub fn derive_from_sql(input: TokenStream) -> TokenStream {
}
});

let field_extractions_arrow = fields.iter().map(|f| {
let field_name = f.ident.as_ref().expect("named field must have identifier");
let db_column_name = get_field_name(f);
quote! {
let #field_name = cell.take(#db_column_name)?;
}
});

let expanded = quote! {
impl google_cloud_bigquery::query::FromSql for #name {
fn from_sql(value: wkt::Value) -> std::result::Result<Self, google_cloud_bigquery::error::ConvertError> {
Expand All @@ -156,6 +167,16 @@ pub fn derive_from_sql(input: TokenStream) -> TokenStream {
}),
}
}

fn from_arrow(cell: google_cloud_bigquery::query::ArrowCell<'_>) -> std::result::Result<Self, google_cloud_bigquery::error::ConvertError> {
if cell.is_null() {
return std::result::Result::Err(google_cloud_bigquery::error::ConvertError::NotNull);
}
#( #field_extractions_arrow )*
std::result::Result::Ok(Self {
#( #field_idents_struct_arrow, )*
})
}
}
};

Expand Down
1 change: 1 addition & 0 deletions src/bigquery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ categories.workspace = true
rust-version.workspace = true

[dependencies]
arrow = { workspace = true, features = ["ipc", "ipc_compression"] }
async-trait.workspace = true
base64.workspace = true
bytes.workspace = true
Expand Down
33 changes: 33 additions & 0 deletions src/bigquery/benchmarks/arrow_jobs_query/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[package]
name = "bigquery-benchmark-arrow-jobs-query"
version = "0.0.0"
publish = false
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true

[lints]
workspace = true

[dependencies]
anyhow.workspace = true
clap = { workspace = true, features = ["derive", "env", "help", "std"] }
google-cloud-bigquery = { workspace = true, features = ["default"] }
tokio = { workspace = true, features = ["full"] }
wkt.workspace = true
stats_alloc = "0.1"
Loading
Loading