You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Tianyang Hu (Jira)" <ji...@apache.org> on 2019/11/11 23:12:00 UTC
[jira] [Created] (BEAM-8612) Convert []beam.T to the underlying
type []T when passed to a DoFn with universal typed (beam.X) input
Tianyang Hu created BEAM-8612:
---------------------------------
Summary: Convert []beam.T to the underlying type []T when passed to a DoFn with universal typed (beam.X) input
Key: BEAM-8612
URL: https://issues.apache.org/jira/browse/BEAM-8612
Project: Beam
Issue Type: New Feature
Components: sdk-go
Reporter: Tianyang Hu
Assignee: Tianyang Hu
Say there are two DoFn: f1, f2.
- f1 declares the output type as []beam.T, and each element has the underlying type int.
- f2 declares the input type as []int
Passing f1 output to f2 works well. The conversion from []beam.T to []int happens at: https://github.com/apache/beam/blob/c7be0643934a87d73483cf1fd3199a425508b03c/sdks/go/pkg/beam/core/runtime/exec/fullvalue.go#L108
But it doesn't work if f2 declares the input type as beam.X, and type cast it to []int. This is because there's no type conversion when passing []beam.T to beam.X.
We may consider support the above case by converting []beam.T to the underlying type []T when passed to a universal type.
An issue is that if []beam.T is nil or empty, we don't know its underlying element type (unless we know which concrete type beam.T or beam.X is bound to, which doesn't seem to be kept at runtime?). In such case, we have to pass []beam.T to beam.X as is.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)