ephraimbuddy commented on PR #23463:
URL: https://github.com/apache/airflow/pull/23463#issuecomment-1117740726

   My suggestion is to have an initial value for the reduce function. That way, 
the task with empty expand argument will be assumed to have expanded only 1 
time which is the same as one task being run. Here's what I mean:
   ```diff
   
   diff --git a/airflow/models/mappedoperator.py 
b/airflow/models/mappedoperator.py
   index aa51a7345..f9661d66a 100644
   --- a/airflow/models/mappedoperator.py
   +++ b/airflow/models/mappedoperator.py
   @@ -606,7 +606,7 @@ class MappedOperator(AbstractOperator):
            from airflow.settings import task_instance_mutation_hook
    
            total_length = functools.reduce(
   -            operator.mul, self._resolve_map_lengths(run_id, 
session=session).values()
   +            operator.mul, self._resolve_map_lengths(run_id, 
session=session).values(),1
            )
    
            state: Optional[TaskInstanceState] = None
   ```


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