[ 
https://issues.apache.org/jira/browse/BEAM-3301?focusedWorklogId=412494&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-412494
 ]

ASF GitHub Bot logged work on BEAM-3301:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Mar/20 18:17
            Start Date: 30/Mar/20 18:17
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on pull request #11257: [BEAM-3301] 
Create runtime invokers for SDF methods.
URL: https://github.com/apache/beam/pull/11257#discussion_r400394073
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/exec/sdf_invokers.go
 ##########
 @@ -0,0 +1,131 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package exec
+
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam/core/funcx"
+       "github.com/apache/beam/sdks/go/pkg/beam/core/sdf"
+       "github.com/apache/beam/sdks/go/pkg/beam/core/util/reflectx"
+       "github.com/apache/beam/sdks/go/pkg/beam/internal/errors"
+       "reflect"
+)
+
+func invokeCreateInitialRestriction(fn *funcx.Fn, elms *FullValue) (rest 
interface{}, err error) {
+       if fn == nil {
+               return nil, nil
+       }
+
+       switch fnT := fn.Fn.(type) {
+       case reflectx.Func1x1:
+               return fnT.Call1x1(elms.Elm), nil
+       case reflectx.Func2x1:
+               return fnT.Call2x1(elms.Elm, elms.Elm2), nil
+       default:
+               var inputs []interface{}
+               switch fn.Fn.Type().NumIn() {
+               case 1:
+                       inputs = []interface{}{elms.Elm}
+               case 2:
+                       inputs = []interface{}{elms.Elm, elms.Elm2}
+               default:
+                       err := errors.Errorf("fn %v has unexpected number of 
inputs: %v", fn.Fn.Name(), fn.Fn.Type().NumIn())
+                       return nil, errors.WithContext(err, "sdf 
CreateInitialRestriction invoker")
+               }
+               rets := fn.Fn.Call(inputs)
+               return rets[0], nil
+       }
+}
+
+func invokeSplitRestriction(fn *funcx.Fn, elms *FullValue, rest interface{}) 
([]interface{}, error) {
 
 Review comment:
   It occurs to me that we don't seem to have the abstract signatures 
documented for the "Provider" methods like SplitRestriction. IIRC we avoided 
doing that for now to avoid accidental usage? It might be good to document the 
expectation here at least, for this and the other SDF methods. eg. 
SplitRestriction(K?, V, RT) []RT
 
----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 412494)
    Time Spent: 11.5h  (was: 11h 20m)

> Go SplittableDoFn support
> -------------------------
>
>                 Key: BEAM-3301
>                 URL: https://issues.apache.org/jira/browse/BEAM-3301
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Henning Rohde
>            Assignee: Daniel Oliveira
>            Priority: Major
>          Time Spent: 11.5h
>  Remaining Estimate: 0h
>
> SDFs will be the only way to add streaming and liquid sharded IO for Go.
> Design doc: https://s.apache.org/splittable-do-fn



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to