jason810496 commented on code in PR #75443:
URL: https://github.com/apache/airflow/pull/75443#discussion_r4358816479


##########
go-sdk/internal/bundle/task.go:
##########
@@ -183,28 +183,28 @@ func (f *taskFunction) call(
                        )
                }
        }
+       if err != nil {
+               return err
+       }
        if branch != nil {
-               // The task pushes the value that decide returns, and decide 
runs only on a result that fn
-               // returned without an error. So the task pushes no XCom when 
fn or decide fails.
-               if err != nil {
-                       return err
-               }
+               // The task pushes the value that decide returns.
                value, skipped, err := f.decide(retValues[0].Interface())
                if err != nil {
                        return err
                }
                rv := reflect.ValueOf(value)
                if rv.Kind() != reflect.Ptr || !rv.IsNil() {
-                       f.sendXcom(ctx, value, sdkClient, logger)
+                       if err := pushReturnValue(ctx, value, sdkClient); err 
!= nil {
+                               return err
+                       }
                }
                return branch.skipDownstream(ctx, sdkClient, skipped, logger)
        }
        // If there are two results, convert the first only if it's not a nil 
pointer
        if len(retValues) > 1 && (retValues[0].Kind() != reflect.Ptr || 
!retValues[0].IsNil()) {
-               res := retValues[0].Interface()
-               f.sendXcom(ctx, res, sdkClient, logger)
+               return pushReturnValue(ctx, retValues[0].Interface(), sdkClient)

Review Comment:
   Added TestPushesNoNilPointer in 
[9150cc1](https://github.com/apache/airflow/pull/75443/commits/9150cc1c81e8156369b888a0d18088d2ede65983),
 thanks.



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

Reply via email to