uranusjr commented on code in PR #69075:
URL: https://github.com/apache/airflow/pull/69075#discussion_r3488532028


##########
task-sdk/src/airflow/sdk/definitions/xcom_arg.py:
##########
@@ -354,8 +354,11 @@ def resolve(self, context: Mapping[str, Any]) -> Any:
                     ti_count=ti_count,
                     session=None,  # Not used in SDK implementation
                 )
-                # None means "no filtering needed" -> use NOTSET to pull all 
values
-                map_indexes = NOTSET if computed is None else computed
+                if computed is None:
+                    # Aggregate the mapped task group as a list, even for a 
single expansion (#69036) or all-None values (#48005)
+                    # Materialise eagerly (one slice request) so a task 
returning the value unchanged can still serialize it
+                    return LazyXComSequence(xcom_arg=self, ti=ti)[:]
+                map_indexes = computed

Review Comment:
   Hmm, this has the potential to kill performance is the map size is large. I 
wonder if it would be appropriate to return the lazy sequence directly, and 
handle it on XCom serialization _if_ it’s actually returned instead.



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