You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/04/22 02:38:21 UTC
[GitHub] [beam] youngoli commented on a change in pull request #11474: [BEAM-9642] Enabling SDF exec runners and fixing small bug.
youngoli commented on a change in pull request #11474:
URL: https://github.com/apache/beam/pull/11474#discussion_r412590798
##########
File path: sdks/go/pkg/beam/core/runtime/exec/sdf.go
##########
@@ -263,20 +266,33 @@ func (n *ProcessSizedElementsAndRestrictions) ProcessElement(ctx context.Context
return errors.Errorf("invalid status for ParDo %v: %v, want Active", n.PDo.UID, n.PDo.status)
}
- userElm := elm.Elm.(*FullValue).Elm.(*FullValue)
rest := elm.Elm.(*FullValue).Elm2
rt := n.inv.Invoke(rest)
+ var mainIn = &MainInput{
Review comment:
Whoops, that was left behind in editing. Fixed
##########
File path: sdks/go/pkg/beam/core/runtime/exec/sdf.go
##########
@@ -263,20 +266,33 @@ func (n *ProcessSizedElementsAndRestrictions) ProcessElement(ctx context.Context
return errors.Errorf("invalid status for ParDo %v: %v, want Active", n.PDo.UID, n.PDo.status)
}
- userElm := elm.Elm.(*FullValue).Elm.(*FullValue)
rest := elm.Elm.(*FullValue).Elm2
rt := n.inv.Invoke(rest)
+ var mainIn = &MainInput{
+ Values: values,
+ RTracker: rt,
+ }
- return n.PDo.processMainInput(&MainInput{
- Key: FullValue{ // User userElm's values but the top-level windows and timestamp.
+ // For the key, the way we fill it out depends on whether the input element
+ // is a KV or single-element. Single-elements might have been lifted out of
+ // their FullValue if they were decoded, so we need to have a case for that.
+ // Also, we use the the top-level windows and timestamp.
+ if userElm, ok := elm.Elm.(*FullValue).Elm.(*FullValue); ok {
Review comment:
Ack. Added a TODO to remind me.
##########
File path: sdks/go/pkg/beam/core/runtime/exec/translate.go
##########
@@ -372,32 +386,43 @@ func (b *builder) makeLink(from string, id linkID) (Node, error) {
switch op {
case graph.ParDo:
- n := &ParDo{UID: b.idgen.New(), Inbound: in, Out: out}
- n.Fn, err = graph.AsDoFn(fn, graph.MainUnknown)
+ dofn, err := graph.AsDoFn(fn, graph.MainUnknown)
if err != nil {
return nil, err
}
- n.PID = transform.GetUniqueName()
-
- input := unmarshalKeyedValues(transform.GetInputs())
- for i := 1; i < len(input); i++ {
- // TODO(herohde) 8/8/2018: handle different windows, view_fn and window_mapping_fn.
- // For now, assume we don't need any information in the pardo payload.
-
- ec, wc, err := b.makeCoderForPCollection(input[i])
- if err != nil {
- return nil, err
+ switch urn {
+ case urnPairWithRestriction:
+ u = &PairWithRestriction{UID: b.idgen.New(), Fn: dofn, Out: out[0]}
+ case urnSplitAndSizeRestrictions:
+ u = &SplitAndSizeRestrictions{UID: b.idgen.New(), Fn: dofn, Out: out[0]}
+ default:
+ n := &ParDo{UID: b.idgen.New(), Fn: dofn, Inbound: in, Out: out}
+ n.PID = transform.GetUniqueName()
+
+ input := unmarshalKeyedValues(transform.GetInputs())
+ for i := 1; i < len(input); i++ {
+ // TODO(herohde) 8/8/2018: handle different windows, view_fn and window_mapping_fn.
Review comment:
Agreed. I was iffy on it myself since even 5 indentations deep was already getting difficult to follow.
##########
File path: sdks/go/pkg/beam/core/runtime/exec/translate.go
##########
@@ -372,32 +386,43 @@ func (b *builder) makeLink(from string, id linkID) (Node, error) {
switch op {
case graph.ParDo:
- n := &ParDo{UID: b.idgen.New(), Inbound: in, Out: out}
- n.Fn, err = graph.AsDoFn(fn, graph.MainUnknown)
+ dofn, err := graph.AsDoFn(fn, graph.MainUnknown)
if err != nil {
return nil, err
}
- n.PID = transform.GetUniqueName()
-
- input := unmarshalKeyedValues(transform.GetInputs())
- for i := 1; i < len(input); i++ {
- // TODO(herohde) 8/8/2018: handle different windows, view_fn and window_mapping_fn.
- // For now, assume we don't need any information in the pardo payload.
-
- ec, wc, err := b.makeCoderForPCollection(input[i])
- if err != nil {
- return nil, err
+ switch urn {
+ case urnPairWithRestriction:
+ u = &PairWithRestriction{UID: b.idgen.New(), Fn: dofn, Out: out[0]}
+ case urnSplitAndSizeRestrictions:
+ u = &SplitAndSizeRestrictions{UID: b.idgen.New(), Fn: dofn, Out: out[0]}
+ default:
+ n := &ParDo{UID: b.idgen.New(), Fn: dofn, Inbound: in, Out: out}
+ n.PID = transform.GetUniqueName()
+
+ input := unmarshalKeyedValues(transform.GetInputs())
+ for i := 1; i < len(input); i++ {
+ // TODO(herohde) 8/8/2018: handle different windows, view_fn and window_mapping_fn.
+ // For now, assume we don't need any information in the pardo payload.
+
+ ec, wc, err := b.makeCoderForPCollection(input[i])
+ if err != nil {
+ return nil, err
+ }
+
+ sid := StreamID{
+ Port: Port{URL: b.desc.GetStateApiServiceDescriptor().GetUrl()},
+ PtransformID: id.to,
+ }
+ sideInputID := fmt.Sprintf("i%v", i) // SideInputID (= local id, "iN")
+ side := NewSideInputAdapter(sid, sideInputID, coder.NewW(ec, wc))
+ n.Side = append(n.Side, side)
}
-
- sid := StreamID{
- Port: Port{URL: b.desc.GetStateApiServiceDescriptor().GetUrl()},
- PtransformID: id.to,
+ if urn == urnProcessSizedElementsAndRestrictions {
+ u = &ProcessSizedElementsAndRestrictions{PDo: n}
+ } else {
+ u = n
}
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org