You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/20 23:48:21 UTC

[GitHub] [beam] youngoli opened a new pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

youngoli opened a new pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188
 
 
   Adding RTrackers as an interface, and adding them to the SDF validation.
   
   I think this is the last real code involved in SDF validation, assuming I'm not forgetting anything. I might do a second pass on the error messages because they seem inconsistent with the old error messages, but the next major task is going to be working on the SDF exec code and doing some testing with the Flink runner.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [x] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [x] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [x] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   Post-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
   Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/)
   Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/) | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/)
   XLang | --- | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/)
   
   Pre-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   --- |Java | Python | Go | Website
   --- | --- | --- | --- | ---
   Non-portable | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/) 
   Portable | --- | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | ---
   
   See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] lostluck commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
lostluck commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#issuecomment-603533918
 
 
   LGTM

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396912202
 
 

 ##########
 File path: sdks/go/pkg/beam/core/graph/fn_test.go
 ##########
 @@ -676,39 +737,77 @@ func (fn *BadSdfElementTRestSize) RestrictionSize(float32, RestT) float64 {
 type BadRestT struct{}
 
 type BadSdfRestTSplitRestParam struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTSplitRestParam) SplitRestriction(int, BadRestT) []RestT {
 	return []RestT{}
 }
 
 type BadSdfRestTSplitRestReturn struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTSplitRestReturn) SplitRestriction(int, RestT) []BadRestT {
 	return []BadRestT{}
 }
 
 type BadSdfRestTRestSize struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTRestSize) RestrictionSize(int, BadRestT) float64 {
 	return 0
 }
 
+type BadSdfRestTCreateTracker struct {
+	*GoodSdf
+}
+
+func (fn *BadSdfRestTCreateTracker) CreateTracker(BadRestT) *RTrackerT {
+	return &RTrackerT{}
+}
+
 // Examples of other type validation that needs to be done.
 
 type BadSdfRestSizeReturn struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestSizeReturn) BadSdfRestSizeReturn(int, RestT) int {
 	return 0
 }
 
+type BadRTrackerT struct{}
 
 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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#issuecomment-602838126
 
 
   Whoops, forgot reviewers.
   R: @lostluck 

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#issuecomment-601956825
 
 
   Run Go PostCommit

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396912979
 
 

 ##########
 File path: sdks/go/pkg/beam/core/sdf/sdf.go
 ##########
 @@ -0,0 +1,74 @@
+// 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 sdf is experimental, incomplete, and not yet meant for general usage.
+package sdf
+
+// RTracker is an interface used to interact with restrictions while processing elements in
+// SplittableDoFns. Each implementation of RTracker is expected to be used for tracking a single
+// restriction type, which is the type that should be used to create the RTracker, and output by
+// TrySplit.
+type RTracker interface {
+	// TryClaim attempts to claim the block of work in the current restriction located at a given
+	// position. This method must be used in the ProcessElement method of Splittable DoFns to claim
+	// work before performing it. If no work is claimed, the ProcessElement is not allowed to perform
+	// work or emit outputs. If the claim is successful, the DoFn must process the entire block. If
+	// the claim is unsuccessful the ProcessElement method of the DoFn must return without performing
+	// any additional work or emitting any outputs.
+	//
+	// TryClaim accepts an arbitrary value that can be interpreted as the position of a block, and
+	// returns a boolean indicating whether the claim succeeded.
+	//
+	// If the claim fails due to an error, that error can be retrieved with GetError.
+	//
+	// For SDFs to work properly, claims must always be monotonically increasing in reference to the
+	// restriction's start and end points, and every block of work in a restriction must be claimed.
+	//
+	// This pseudocode example illustrates the typical usage of TryClaim:
+	//
+	// 	pos = position of first block after restriction.start
+	// 	for TryClaim(pos) == true {
+	// 		// Do all work in the claimed block and emit outputs.
+	// 		pos = position of next block
+	// 	}
+	// 	return
+	TryClaim(pos interface{}) (ok bool)
+
+	// GetError returns the error that made this RTracker stop executing, and it returns null if no
 
 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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396917290
 
 

 ##########
 File path: sdks/go/pkg/beam/core/graph/fn_test.go
 ##########
 @@ -562,7 +595,13 @@ func (fn *GoodSdf) RestrictionSize(int, RestT) float64 {
 	return 0
 }
 
-// TODO(BEAM-3301): Add ProcessElement impl. when restriction trackers are in.
+func (fn *GoodSdf) CreateTracker(RestT) *RTrackerT {
+	return &RTrackerT{}
+}
+
+func (fn *GoodSdf) ProcessElement(*RTrackerT, int) int {
 
 Review comment:
   That was one of the approaches I considered. I got some feedback on it both ways, but ultimately I didn't really like that approach because it's a bit unintuitive for users to get a different RTracker type than what they created. Documentation would have to do some extra legwork. Plus, it goes against the trend in Go to have users understand what's happening with concurrency.
   
   But anyway, I'm open to that approach and may pivot to it if it makes sense, but for now the plan is, when we add dynamic splitting, to provide a concurrency wrapper and have users wrap their RTrackers themselves, or just write their own concurrency. (This is apparently also the way python does it, so it's not completely unprecedented.)

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli commented on issue #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#issuecomment-603561036
 
 
   Squashed fixup commits

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396803249
 
 

 ##########
 File path: sdks/go/pkg/beam/core/graph/fn_test.go
 ##########
 @@ -562,7 +595,13 @@ func (fn *GoodSdf) RestrictionSize(int, RestT) float64 {
 	return 0
 }
 
-// TODO(BEAM-3301): Add ProcessElement impl. when restriction trackers are in.
+func (fn *GoodSdf) CreateTracker(RestT) *RTrackerT {
+	return &RTrackerT{}
+}
+
+func (fn *GoodSdf) ProcessElement(*RTrackerT, int) int {
 
 Review comment:
   What do you think of having ProcessElement actually just have an sdf.RTracker value? 
   Having it as the interface simplifies our wrapping approach for dynamic splitting, and means the framework can do it all the time, for safety etc.
   
   CreateTracker would still need the actual implementation type, and check that it implements sdf.RTracker of course.
   
   We can always extend things to allow a user to "unwrap" the interface if they need direct access to their RTracker implementation for whatever reason.

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] youngoli merged pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
youngoli merged pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396795769
 
 

 ##########
 File path: sdks/go/pkg/beam/core/graph/fn_test.go
 ##########
 @@ -676,39 +737,77 @@ func (fn *BadSdfElementTRestSize) RestrictionSize(float32, RestT) float64 {
 type BadRestT struct{}
 
 type BadSdfRestTSplitRestParam struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTSplitRestParam) SplitRestriction(int, BadRestT) []RestT {
 	return []RestT{}
 }
 
 type BadSdfRestTSplitRestReturn struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTSplitRestReturn) SplitRestriction(int, RestT) []BadRestT {
 	return []BadRestT{}
 }
 
 type BadSdfRestTRestSize struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestTRestSize) RestrictionSize(int, BadRestT) float64 {
 	return 0
 }
 
+type BadSdfRestTCreateTracker struct {
+	*GoodSdf
+}
+
+func (fn *BadSdfRestTCreateTracker) CreateTracker(BadRestT) *RTrackerT {
+	return &RTrackerT{}
+}
+
 // Examples of other type validation that needs to be done.
 
 type BadSdfRestSizeReturn struct {
-	*GoodDoFn
+	*GoodSdf
 }
 
 func (fn *BadSdfRestSizeReturn) BadSdfRestSizeReturn(int, RestT) int {
 	return 0
 }
 
+type BadRTrackerT struct{}
 
 Review comment:
   Consider commenting that this "RTracker" isn't implementing the RTracker interface.

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [beam] lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.

Posted by GitBox <gi...@apache.org>.
lostluck commented on a change in pull request #11188: [BEAM-3301] Adding restriction trackers and validation.
URL: https://github.com/apache/beam/pull/11188#discussion_r396804143
 
 

 ##########
 File path: sdks/go/pkg/beam/core/sdf/sdf.go
 ##########
 @@ -0,0 +1,74 @@
+// 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 sdf is experimental, incomplete, and not yet meant for general usage.
+package sdf
+
+// RTracker is an interface used to interact with restrictions while processing elements in
+// SplittableDoFns. Each implementation of RTracker is expected to be used for tracking a single
+// restriction type, which is the type that should be used to create the RTracker, and output by
+// TrySplit.
+type RTracker interface {
+	// TryClaim attempts to claim the block of work in the current restriction located at a given
+	// position. This method must be used in the ProcessElement method of Splittable DoFns to claim
+	// work before performing it. If no work is claimed, the ProcessElement is not allowed to perform
+	// work or emit outputs. If the claim is successful, the DoFn must process the entire block. If
+	// the claim is unsuccessful the ProcessElement method of the DoFn must return without performing
+	// any additional work or emitting any outputs.
+	//
+	// TryClaim accepts an arbitrary value that can be interpreted as the position of a block, and
+	// returns a boolean indicating whether the claim succeeded.
+	//
+	// If the claim fails due to an error, that error can be retrieved with GetError.
+	//
+	// For SDFs to work properly, claims must always be monotonically increasing in reference to the
+	// restriction's start and end points, and every block of work in a restriction must be claimed.
+	//
+	// This pseudocode example illustrates the typical usage of TryClaim:
+	//
+	// 	pos = position of first block after restriction.start
+	// 	for TryClaim(pos) == true {
+	// 		// Do all work in the claimed block and emit outputs.
+	// 		pos = position of next block
+	// 	}
+	// 	return
+	TryClaim(pos interface{}) (ok bool)
+
+	// GetError returns the error that made this RTracker stop executing, and it returns null if no
 
 Review comment:
   returns nil*

----------------------------------------------------------------
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


With regards,
Apache Git Services