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

bigquery: panic when convert array of range #10878

Closed
tientt-holistics opened this issue Sep 17, 2024 · 1 comment · Fixed by #10883
Closed

bigquery: panic when convert array of range #10878

tientt-holistics opened this issue Sep 17, 2024 · 1 comment · Fixed by #10883
Assignees
Labels
api: bigquery Issues related to the BigQuery API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tientt-holistics
Copy link

Environment details

Programming language: go
OS: Ubuntu 22.04.4
Language runtime version: 1.23.1
Package version: cloud.google.com/go/bigquery v1.62.0

Code and Dependencies

package main

func main() {
  sql := "SELECT [RANGE<DATE> '[2023-01-01, 2024-01-01)'];"
  client, err := bigquery.NewClient(ctx, options...)
  query := client.Query(sql)
  iter, err := query.Read(ctx)
  
  var row []bigquery.Value
  iter.Next(&row)
}
go.mod
module modname

go 1.23.1

require (
   cloud.google.com/go v0.115.0
   cloud.google.com/go/bigquery v1.62.0
)

Expected behavior

return ['[2023-01-01, 2024-01-01)']

Actual behavior

Panic

cloud.google.com/go/bigquery.convertRow(0xc00089a460, {0xc000ab22a0, 0x3, 0x4}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/value.go:903 +0x711
cloud.google.com/go/bigquery.convertRows({0xc000ba61c8, 0x1, 0x1}, {0xc000ab22a0, 0x3, 0x4}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/value.go:880 +0x12b
cloud.google.com/go/bigquery.fetchCachedPage({0x3819ca8, 0xc0008982a0}, 0xc00089a4b0, {0xc000ab22a0, 0x3, 0x4}, 0x0, 0x0, {0x0, 0x0}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/iterator.go:392 +0x1ce
cloud.google.com/go/bigquery.fetchPage({0x3819ca8, 0xc0008982a0}, 0xc00089a4b0, {0x0, 0x0, 0x0}, 0x0, 0x0, {0x0, 0x0}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/iterator.go:246 +0xdc
cloud.google.com/go/bigquery.(*RowIterator).fetch(0xc0005bc1c0, 0x0, {0x0, 0x0}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/iterator.go:198 +0x128
google.golang.org/api/iterator.(*PageInfo).fill(0xc00089a500, 0x0) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/google.golang.org/[email protected]/iterator/iterator.go:139 +0x72
google.golang.org/api/iterator.(*PageInfo).next(0xc00089a500) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/google.golang.org/[email protected]/iterator/iterator.go:118 +0x125
cloud.google.com/go/bigquery.(*RowIterator).Next(0xc0005bc1c0, {0x33d2f60, 0xc000523ce0}) /home/natton/.gvm/pkgsets/go1.23.1/global/pkg/mod/cloud.google.com/go/[email protected]/iterator.go:170 +0x202

Additional context

Checking the code in https://github.com/googleapis/google-cloud-go/blob/main/bigquery/value.go#L903, there is no array handling for range type

@tientt-holistics tientt-holistics added the triage me I really want to be triaged. label Sep 17, 2024
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the BigQuery API. label Sep 17, 2024
@shollyman
Copy link
Contributor

Thanks for the report!

@shollyman shollyman added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed triage me I really want to be triaged. labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants