You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was found in the Go SDK but the root cause seems to be in the expansion service. When performing an xlang BigQueryIO read from a query, the Beam rows it outputs end up being structurally identical to the registered output type in Go, but not actually equivalent, so it can't be converted to the named struct output despite being structurally identical.
Workaround in Go SDK
To workaround this issue in the short term, turn the named struct type that's being used as the output to a type alias of the unnamed type. This can easily be done by inserting an = sign.
Before: type OutputRow struct {...}
After: type OutputRow = struct {...}
Note that this doesn't play well with Beam Go's type registration, you'll need to avoid registering the type alias.
Log Snippets
Here's a snippet of the error on the Go side to see how it manifests:
panic: interface conversion: interface {} is struct { Counter *int64 "beam:\"counter\""; Rand_data *struct { Flip *bool "beam:\"flip\""; Num *int64 "beam:\"num\""; Word *string "beam:\"word\"" } "beam:\"rand_data\"" }, not bigquery.TestRowPtrs
Full error:
while executing Process for Plan[s02-67]:
2: DataSink[S[ptransform-65@localhost:12371]] Coder:W;coder-80<LP;coder-81<R[bigquery.TestRow]>>!GWC
3: PCollection[pcollection-72] Out:[2]
4: ParDo[bigquery.castFn] Out:[2]
1: DataSource[S[ptransform-64@localhost:12371], 0] Coder:W;coder-76<LP;coder-77<R[struct { Counter *int64 "beam:\"counter\""; Rand_data *struct { Flip *bool "beam:\"flip\""; Num *int64 "beam:\"num\""; Word *string "beam:\"word\"" } "beam:\"rand_data\"" }]>>!GWC Out:4
caused by:
panic: interface conversion: interface {} is struct { Counter *int64 "beam:\"counter\""; Rand_data *struct { Flip *bool "beam:\"flip\""; Num *int64 "beam:\"num\""; Word *string "beam:\"word\"" } "beam:\"rand_data\"" }, not bigquery.TestRowPtrs goroutine 58 [running]:
runtime/debug.Stack()
/usr/lib/google-golang/src/runtime/debug/stack.go:24 +0x65
github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/exec.callNoPanic.func1()
{...}/repos/beam/sdks/go/pkg/beam/core/runtime/exec/util.go:58 +0xa5
panic({0xe0d380, 0xc0003a04e0})
/usr/lib/google-golang/src/runtime/panic.go:866 +0x212
github.com/apache/beam/sdks/v2/go/pkg/beam/register.(*caller1x1[...]).Call1x1(...)
{...}/repos/beam/sdks/go/pkg/beam/register/register.go:3205
And a snippet of the raw schema protos that are received by the Go SDK, compared with the schema it's expecting.
What happened?
This was found in the Go SDK but the root cause seems to be in the expansion service. When performing an xlang BigQueryIO read from a query, the Beam rows it outputs end up being structurally identical to the registered output type in Go, but not actually equivalent, so it can't be converted to the named struct output despite being structurally identical.
Workaround in Go SDK
To workaround this issue in the short term, turn the named struct type that's being used as the output to a type alias of the unnamed type. This can easily be done by inserting an = sign.
Before:
type OutputRow struct {...}
After:
type OutputRow = struct {...}
Note that this doesn't play well with Beam Go's type registration, you'll need to avoid registering the type alias.
Log Snippets
Here's a snippet of the error on the Go side to see how it manifests:
And a snippet of the raw schema protos that are received by the Go SDK, compared with the schema it's expecting.
Received schema:
Expected schema:
To see the data above, simply add the following lines after graphx/coder.go:371:
Issue Priority
Priority: 2
Issue Component
Component: cross-language
The text was updated successfully, but these errors were encountered: