lostluck commented on code in PR #34566: URL: https://github.com/apache/beam/pull/34566#discussion_r2031778302
########## sdks/go/pkg/beam/runners/prism/internal/preprocess.go: ########## @@ -106,7 +106,21 @@ func (p *preprocessor) preProcessGraph(comps *pipepb.Components, j *jobservices. // If there's an unknown urn, and it's not composite, simply add it to the leaves. if len(t.GetSubtransforms()) == 0 { - leaves[tid] = struct{}{} + shouldAdd := true + + // However, if it is an empty transform with identical input/output pcollections, + // it will be discarded. + if len(t.GetInputs()) == 1 && len(t.GetOutputs()) == 1 { + inputID := getOnlyValue(t.GetInputs()) + outputID := getOnlyValue(t.GetOutputs()) + if inputID == outputID { + shouldAdd = false Review Comment: I'd use `continue` here instead of adding a boolean to set and check. Reduces the cyclomatic complexity of the surrounding code. -- 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