Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bigquery): missing schema for empty result set on stateless queries #10935

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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: 3 additions & 0 deletions bigquery/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3581,6 +3581,9 @@ func compareRead(it *RowIterator, want [][]Value, compareTotalRows bool) (msg st
if err != nil {
return err.Error(), false
}
if want != nil && len(it.Schema) == 0 {
return "missing schema", false
}
if len(got) != len(want) {
return fmt.Sprintf("%s got %d rows, want %d", jobStr, len(got), len(want)), false
}
Expand Down
7 changes: 6 additions & 1 deletion bigquery/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ func fetchPage(ctx context.Context, src *rowSource, schema Schema, startIndex ui
return fetchTableResultPage(ctx, src, schema, startIndex, pageSize, pageToken)
}
// No rows, but no table or job reference. Return an empty result set.
return &fetchPageResult{}, nil
if schema == nil {
schema = bqToSchema(src.cachedSchema)
}
return &fetchPageResult{
schema: schema,
}, nil
}
return result, nil
}
Expand Down
Loading