phanikumv commented on code in PR #77080:
URL: https://github.com/apache/airflow/pull/77080#discussion_r4707326559


##########
airflow-core/adr/lang-sdk/0016-mapped-tasks-across-lang-sdks.md:
##########
@@ -339,19 +371,32 @@ Before the runtime starts, the supervisor turns every 
binding into what the runt
 | `literal` | passes it on | `literal` |
 | `xcom` | GETs the row through the XCom backend, then takes `element_index` 
when set | `literal` |
 | `tuple` | reads every part and puts them in one array, in zip order | 
`literal` |
-| any of these with `kwarg`, no `apply_map` | then takes that key, else reads 
`fallback`; with neither, fails the task | `literal` |
-| any of these with `apply_map` | reads the value and any `fallback`, and 
leaves the callables and `kwarg` to the runtime | `literal`, with `apply_map` |
+| `expand_kwargs` in the run context | reads the dict once and, unless the 
bindings have `apply_map`, checks its keys (*Which signature a call is checked 
against*) | nothing |
+| any of these with `kwarg`, no `apply_map` | takes that key from the dict, 
else reads `fallback`; with neither, fails the task | `literal` |
+| any of these with `apply_map` | reads the dict and any `fallback`, and 
leaves the callables and `kwarg` to the runtime; checks the dict when it 
answers `ApplyMap` | `literal`, with `apply_map` |
 | `sequence` | passes it on | `sequence` |
 
-The run context gains one field:
+The run context gains two fields:
 
 ```python
 class TIRunContext(BaseModel):
     ...
     needs_mapped_length: bool | None = None
-    """Set only for a Lang-SDK task: True when its return value is expanded 
over downstream, so the
-    supervisor has to measure it. Derived from ``not ti.is_mapped and 
any(task.iter_mapped_dependants())``.
-    None for a Python task, which measures its own."""
+    """
+    Whether the supervisor has to measure this task's return value.
+
+    Set only for a Lang-SDK task: True when its return value is expanded over 
downstream. Derived
+    from ``not ti.is_mapped and any(task.iter_mapped_dependants())``. None for 
a Python task, which
+    measures its own.
+    """
+
+    expand_kwargs: XComRef | None = None

Review Comment:
   The field is typed XComRef | None and has no apply_map flag, which leaves 
two cases undescribed:
   
   1. A literal row: line 158 says a list-of-dicts value can be an xcomref, so 
it can also be literal, and YAML Decision 5 (line 91) allows $expand: [{path: 
a, size: 1}, …] on run: tasks. An XComRef can't point at that row.
   2. partial() on every parameter, plus map(): for example 
foo.partial(a=1).expand_kwargs(rows.map(f)). No binding carries kwarg, so none 
has apply_map.



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