nailo2c commented on code in PR #67356:
URL: https://github.com/apache/airflow/pull/67356#discussion_r3522558500
##########
airflow-core/src/airflow/cli/commands/task_command.py:
##########
@@ -429,6 +430,36 @@ def task_test(args, dag: DAG | None = None) -> None:
passed_in_params = json.loads(args.task_params)
sdk_task.params.update(passed_in_params)
+ if isinstance(sdk_task, MappedOperator):
+ from airflow.sdk.definitions._internal.expandinput import (
+ DictOfListsExpandInput,
+ ListOfDictsExpandInput,
+ )
+
+ expand_input = sdk_task._get_specified_expand_input()
+
+ expand_input_attr = sdk_task._expand_input_attr
+ if isinstance(expand_input, DictOfListsExpandInput):
+ new_expand_input_dict = dict(expand_input.value)
+ for k in expand_input.value:
+ if k in passed_in_params:
+ new_param = passed_in_params[k]
+ new_expand_input_dict[k] = [new_param] *
(args.map_index + 1)
Review Comment:
I think there is a bug here. For example, with a Dag like this:
```python
@task
def consume(a, b):
print(f"a={a}, b={b}")
consume.expand(a=[1, 2, 3], b=[10, 20, 30])
```
Running this works as expected:
```bash
airflow tasks test mapped_override_repro consume 2026-01-01 --map-index 4
```
It prints:
```text
a=2, b=20
```
However, if I only override `b`:
```bash
airflow tasks test mapped_override_repro consume 2026-01-01 --map-index 4
--task-params '{"b": 99}'
```
It prints:
```text
a=1, b=99
```
I would expect `a` to remain resolved from the original `map_index=4`, so
this looks like the override changes the mapping of arguments that were not
overridden.
--
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]