riteshghorse commented on code in PR #17432:
URL: https://github.com/apache/beam/pull/17432#discussion_r859912846
##########
sdks/go/pkg/beam/core/runtime/exec/sdf_invokers.go:
##########
@@ -351,3 +352,97 @@ func (n *cweInvoker) Reset() {
n.args[i] = nil
}
}
+
+// trInvoker is an invoker for TruncateRestriction.
+type trInvoker struct {
+ fn *funcx.Fn
+ args []interface{}
+ call func(rest interface{}, elms *FullValue) (pair interface{})
+}
+
+var offsetrangeTracker = reflect.TypeOf((*offsetrange.Tracker)(nil)).Elem()
+
+func DefaultTruncateRestriction(restTracker interface{}) (newRest interface{})
{
+ tracker, ok := restTracker.(sdf.BoundableRTracker)
+ if !ok {
+ return nil
+ }
+ switch tracker.(type) {
+ case *offsetrange.Tracker:
+ if tracker.(*offsetrange.Tracker).IsBounded() {
+ return
restTracker.(*offsetrange.Tracker).GetRestriction().(offsetrange.Restriction)
+ }
+ default:
+ return nil
+ }
+ return nil
Review Comment:
yeah that would make it clean.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]