Skip to content

Commit 061f6f8

Browse files
authored
feat(go/adbc/driver/bigquery): error if we lack readSessionUser (#3297)
Fixes #3281.
1 parent 8dd3d0b commit 061f6f8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go/adbc/driver/bigquery/record_reader.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ func runQuery(ctx context.Context, query *bigquery.Query, executeUpdate bool) (b
7373
// If there is no schema in the row iterator, then arrow
7474
// iterator should be empty (#2173)
7575
if iter.TotalRows > 0 {
76+
// !IsAccelerated() -> failed to get Arrow stream -> we are
77+
// probably lacking permissions. readSessionUser may sound
78+
// unrelated but creating a "read session" is the first step
79+
// of using the Storage API. Note that Google swallows the
80+
// real error, so this is the best we can do.
81+
// https://cloud.google.com/bigquery/docs/reference/storage#create_a_session
82+
if !iter.IsAccelerated() {
83+
return nil, -1, adbc.Error{
84+
Code: adbc.StatusUnauthorized,
85+
Msg: "[bigquery] Arrow reader requires roles/bigquery.readSessionUser, see https://github.com/apache/arrow-adbc/issues/3282",
86+
}
87+
}
7688
if arrowIterator, err = iter.ArrowIterator(); err != nil {
7789
return nil, -1, err
7890
}

0 commit comments

Comments
 (0)