Robert Burke created BEAM-7444:
----------------------------------

             Summary: Support ReIterators in the code generator.
                 Key: BEAM-7444
                 URL: https://issues.apache.org/jira/browse/BEAM-7444
             Project: Beam
          Issue Type: Bug
          Components: sdk-go
            Reporter: Robert Burke


Currently trying to generate re-iterators for the Go SDK will generate 
incorrect Go code (it won't compile).

Specifically, an iterator are parameters of the shape: func(*T) bool
while a re-iterator is of the shape func() func(*T) bool
That is, a re-iterator is a function that returns iterators.

The code generator's NameType method [1] should be updated to recognize the 
signature of a re-iterator, have an added makeReIterator method that verifies 
that it's a ReIterator, similar to makeInput for iterators [2]. Likely 
makeReIterator will need to use makeInput to properly handle the check, similar 
to how UnforldReIter is implemented.
[https://github.com/apache/beam/blob/a2b0ad14f1525d1a645cb26f5b8ec45692d9d54e/sdks/go/pkg/beam/core/funcx/sideinput.go#L92]



The returned iterator would need it's code generated for performance, by 
recursively registring the return type. 


[[1]https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/util/starcgenx/starcgenx.go#L596|https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/util/starcgenx/starcgenx.go#L596]

[2][https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/util/starcgenx/starcgenx.go#L532]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to