This is an automated email from the ASF dual-hosted git repository.

altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new c02bfcf  Fix top function name & regen shims.
     new 2bb8e0d  Merge pull request #7856 from lostluck/fixtop
c02bfcf is described below

commit c02bfcf20454dc57a3b5668b8ada40e816260507
Author: Robert Burke <rob...@frantil.com>
AuthorDate: Fri Feb 15 19:48:45 2019 +0000

    Fix top function name & regen shims.
---
 sdks/go/pkg/beam/transforms/top/top.go       |  4 ++--
 sdks/go/pkg/beam/transforms/top/top.shims.go | 28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/sdks/go/pkg/beam/transforms/top/top.go 
b/sdks/go/pkg/beam/transforms/top/top.go
index a7a0208..cc72a22 100644
--- a/sdks/go/pkg/beam/transforms/top/top.go
+++ b/sdks/go/pkg/beam/transforms/top/top.go
@@ -110,7 +110,7 @@ func newCombineFn(less interface{}, n int, t reflect.Type, 
reversed bool) *combi
        fn := &combineFn{Less: beam.EncodedFunc{Fn: reflectx.MakeFunc(less)}, 
N: n, Type: beam.EncodedType{T: t}, Reversed: reversed}
        // Running SetupFn at pipeline construction helps validate the
        // combineFn, and simplify testing.
-       fn.SetupFn()
+       fn.Setup()
        return fn
 }
 
@@ -182,7 +182,7 @@ type combineFn struct {
        less reflectx.Func2x1
 }
 
-func (f *combineFn) SetupFn() {
+func (f *combineFn) Setup() {
        f.enc = beam.NewElementEncoder(f.Type.T)
        f.dec = beam.NewElementDecoder(f.Type.T)
 }
diff --git a/sdks/go/pkg/beam/transforms/top/top.shims.go 
b/sdks/go/pkg/beam/transforms/top/top.shims.go
index 8bb0cff..a0559d9 100644
--- a/sdks/go/pkg/beam/transforms/top/top.shims.go
+++ b/sdks/go/pkg/beam/transforms/top/top.shims.go
@@ -34,6 +34,7 @@ func init() {
        reflectx.RegisterFunc(reflect.TypeOf((*func(accum,accum) 
(accum))(nil)).Elem(), funcMakerAccumAccumГAccum)
        reflectx.RegisterFunc(reflect.TypeOf((*func(accum,typex.T) 
(accum))(nil)).Elem(), funcMakerAccumTypex۰TГAccum)
        reflectx.RegisterFunc(reflect.TypeOf((*func(accum) 
([]typex.T))(nil)).Elem(), funcMakerAccumГSliceOfTypex۰T)
+       reflectx.RegisterFunc(reflect.TypeOf((*func() ())(nil)).Elem(), 
funcMakerГ)
        reflectx.RegisterFunc(reflect.TypeOf((*func() (accum))(nil)).Elem(), 
funcMakerГAccum)
 }
 
@@ -44,6 +45,7 @@ func wrapMakerCombineFn(fn interface{}) 
map[string]reflectx.Func {
                "CreateAccumulator": reflectx.MakeFunc(func() (accum) { return 
dfn.CreateAccumulator() }),
                "ExtractOutput": reflectx.MakeFunc(func(a0 accum) ([]typex.T) { 
return dfn.ExtractOutput(a0) }),
                "MergeAccumulators": reflectx.MakeFunc(func(a0 accum, a1 accum) 
(accum) { return dfn.MergeAccumulators(a0, a1) }),
+               "Setup": reflectx.MakeFunc(func() { dfn.Setup() }),
        }
 }
 
@@ -125,6 +127,32 @@ func (c *callerAccumГSliceOfTypex۰T) Call1x1(arg0 
interface{}) (interface{}) {
        return c.fn(arg0.(accum))
 }
 
+type callerГ struct {
+       fn func() ()
+}
+
+func funcMakerГ(fn interface{}) reflectx.Func {
+       f := fn.(func() ())
+       return &callerГ{fn: f}
+}
+
+func (c *callerГ) Name() string {
+       return reflectx.FunctionName(c.fn)
+}
+
+func (c *callerГ) Type() reflect.Type {
+       return reflect.TypeOf(c.fn)
+}
+
+func (c *callerГ) Call(args []interface{}) []interface{} {
+       c.fn()
+       return []interface{}{}
+}
+
+func (c *callerГ) Call0x0() () {
+       c.fn()
+}
+
 type callerГAccum struct {
        fn func() (accum)
 }

Reply via email to