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


##########
go-sdk/pkg/execution/client.go:
##########
@@ -299,7 +300,7 @@ func (c *CoordinatorClient) PushXCom(
        value any,
 ) error {
        // Unlike a task state value, nil is allowed: it is pushed as JSON null.
-       encoded, _, err := validateJSONRepresentable(value)
+       encoded, _, err := 
validateJSONRepresentable(emptyIfNilCollection(value))

Review Comment:
   `PushXCom(ctx, ti, "rows", []string(nil))` used to store null and now stores 
`[]`. Should this live in `pushReturnValue` only?



##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/Client.kt:
##########
@@ -187,7 +187,7 @@ class Client internal constructor(
    */
   @JvmOverloads fun setXCom(
     key: String = XCOM_RETURN_KEY,
-    value: Any,
+    value: Any?,

Review Comment:
   Could the KDoc say `null` is allowed and stores a null XCom? `java.rst` 
could mention returning null too.



##########
go-sdk/internal/bundle/task.go:
##########
@@ -192,16 +192,14 @@ func (f *taskFunction) call(
                if err != nil {
                        return err
                }
-               rv := reflect.ValueOf(value)
-               if rv.Kind() != reflect.Ptr || !rv.IsNil() {
-                       if err := pushReturnValue(ctx, value, sdkClient); err 
!= nil {
-                               return err
-                       }
+               if err := pushReturnValue(ctx, value, sdkClient); err != nil {

Review Comment:
   The `DecideFunc` doc above still says a nil pointer skips the push. Needs an 
update.



##########
go-sdk/internal/bundle/task.go:
##########
@@ -192,16 +192,14 @@ func (f *taskFunction) call(
                if err != nil {
                        return err
                }
-               rv := reflect.ValueOf(value)
-               if rv.Kind() != reflect.Ptr || !rv.IsNil() {
-                       if err := pushReturnValue(ctx, value, sdkClient); err 
!= nil {
-                               return err
-                       }
+               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()) {
+       // A function that returns only an error has no result to push. Any 
other result is pushed, so a

Review Comment:
   `TaskHandler` godoc in `go-sdk/airflow/task_handler.go` still says only a 
non-nil result is pushed.



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