shunping commented on code in PR #35876: URL: https://github.com/apache/beam/pull/35876#discussion_r2280048481
########## sdks/go/pkg/beam/io/xlang/bigtableio/bigtable.go: ########## @@ -135,3 +138,36 @@ func Read(s beam.Scope, projectId string, instanceId string, table string, opts outs := xlschema.Transform(s, btConfig, readURN, xlschema.ExpansionAddr(addr), xlschema.UnnamedOutputType(typex.New(reflect.TypeOf(Row{})))) return outs[beam.UnnamedOutputTag()] } + +type WriteOption func(*writeConfig) +type writeConfig struct { + addr string +} + +// WriteExpansionAddr specifies the address of a persistent expansion service to use for a Write +// transform. If this is not provided, or if an empty string is provided, the transform will +// automatically start an appropriate expansion service instead. +func WriteExpansionAddr(addr string) WriteOption { + return func(wc *writeConfig) { + wc.addr = addr + } +} + +// Write writes rows to a Bigtable table. +func Write(s beam.Scope, projectId string, instanceId string, table string, col beam.PCollection, opts ...WriteOption) { Review Comment: The added test does not actually test the write functionality you implemented here. Please refer to https://github.com/apache/beam/commit/4eed089e180c13e79cb8add058183e067a477f19 for adding an integration test for writing to bigtable. The xlang bigtableio tests should be put in `/sdks/go/test/integration/io/xlang/bigtable/bigtable_test.go`. ########## sdks/go/pkg/beam/io/xlang/bigtableio/bigtable.go: ########## @@ -135,3 +138,36 @@ func Read(s beam.Scope, projectId string, instanceId string, table string, opts outs := xlschema.Transform(s, btConfig, readURN, xlschema.ExpansionAddr(addr), xlschema.UnnamedOutputType(typex.New(reflect.TypeOf(Row{})))) return outs[beam.UnnamedOutputTag()] } + +type WriteOption func(*writeConfig) +type writeConfig struct { + addr string +} + +// WriteExpansionAddr specifies the address of a persistent expansion service to use for a Write +// transform. If this is not provided, or if an empty string is provided, the transform will +// automatically start an appropriate expansion service instead. +func WriteExpansionAddr(addr string) WriteOption { + return func(wc *writeConfig) { + wc.addr = addr + } +} + +// Write writes rows to a Bigtable table. +func Write(s beam.Scope, projectId string, instanceId string, table string, col beam.PCollection, opts ...WriteOption) { Review Comment: The added test does not actually test the write functionality you implemented here. Please refer to https://github.com/apache/beam/commit/4eed089e180c13e79cb8add058183e067a477f19 for adding an integration test for writing to bigtable. Also the xlang bigtableio tests should be put in `/sdks/go/test/integration/io/xlang/bigtable/bigtable_test.go`. -- 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. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org