[
https://issues.apache.org/jira/browse/BEAM-11106?focusedWorklogId=775212&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-775212
]
ASF GitHub Bot logged work on BEAM-11106:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 26/May/22 19:17
Start Date: 26/May/22 19:17
Worklog Time Spent: 10m
Work Description: lostluck commented on code in PR #17770:
URL: https://github.com/apache/beam/pull/17770#discussion_r882993931
##########
sdks/go/pkg/beam/core/graph/fn.go:
##########
@@ -1003,6 +1003,14 @@ func validateSdfSigTypes(fn *Fn, num int) error {
"Ensure that all restrictions in an SDF
are the same type.",
truncateRestrictionName, 0,
method.Ret[0].T, restrictionT, createInitialRestrictionName)
}
+ processFn := fn.methods[processElementName]
+ if len(processFn.Ret) > 0 &&
processFn.Ret[len(processFn.Ret)-1].T !=
reflect.TypeOf((*sdf.ProcessContinuation)(nil)).Elem() {
+ err := errors.Errorf("mismatched output type in
method %v, return %v: got: %v, want: %v",
+ processElementName,
len(processFn.Ret)-1, method.Ret[len(processFn.Ret)-1].T,
reflect.TypeOf((*sdf.ProcessContinuation)(nil)).Elem())
+ return errors.SetTopLevelMsgf(err, "Mismatched
output type in method %v, "+
+ "return value at index %v. Got: %v,
Want: %v (from method %v).",
+ processElementName,
len(processFn.Ret)-1, method.Ret[len(processFn.Ret)-1].T,
reflect.TypeOf((*sdf.ProcessContinuation)(nil)).Elem(), truncateRestrictionName)
+ }
Review Comment:
Since processFn is a `funcx.Fn` you can check if ProcessContinuations are
part of the signature by calling:
`i, exists := processFn.ProcessContinuation()`
https://github.com/apache/beam/blob/6de01035994cb5aa5a62c6f2ab47082dc06aaedd/sdks/go/pkg/beam/core/funcx/fn.go#L324
As written, you're only checking the last paraemter, which might be an
`error` instead.
Issue Time Tracking
-------------------
Worklog Id: (was: 775212)
Time Spent: 10h (was: 9h 50m)
> [Go SDK] Truncating SDFs during drain
> -------------------------------------
>
> Key: BEAM-11106
> URL: https://issues.apache.org/jira/browse/BEAM-11106
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-go
> Reporter: Robert Burke
> Assignee: Ritesh Ghorse
> Priority: P3
> Fix For: 2.39.0
>
> Time Spent: 10h
> Remaining Estimate: 0h
>
> Allow SDFs to specify a restriction truncation method to permit faster drains.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)