You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kevinhongzl (via GitHub)" <gi...@apache.org> on 2026/09/24 01:33:39 UTC

Re: [PR] Enable mapped task argument overrides in `airflow tasks test` [airflow]

kevinhongzl commented on code in PR #67356:
URL: https://github.com/apache/airflow/pull/67356#discussion_r4088937375


##########
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:
   Really appreciate your review @aaron-y-chen ! Thanks for pointing out the Cartesian product case, and I'll give this a fix real quick.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org