GeryDeKocliko opened a new issue, #49737:
URL: https://github.com/apache/airflow/issues/49737

   ### Apache Airflow version
   
   3.0.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Hi,
   
   As outlined in the documentation, I’m attempting to filter out items in my 
dynamic task mapping by returning `None` within the filter task.
   
   See : 
https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/dynamic-task-mapping.html#filtering-items-from-a-mapped-task
   
   However, I’m observing that `None` values are still being passed to the 
subsequent `expand`, which is not the expected behavior.
   
   ### What you think should happen instead?
   
   The `None` value must not be passed to the next `expand`.
   
   ### How to reproduce
   
   ```
   from airflow.decorators import dag, task
   
   @task
   def generate_data():
       return [1, None, 3]
   
   
   @task
   def filter_item_from_mapped_task(item):
       if item is None:
           return None
       return item
   
   
   @task
   def print_item(item):
       assert item is not None
       print(item)
   
   
   @dag(
       dag_id='test_bug_dag',
   )
   def test_bug_dag():
       data = generate_data()
       filtered_data = filter_item_from_mapped_task.expand(item=data)
       print_item.expand(item=filtered_data)
   
   test_bug_dag()
   ```
   
   ### Operating System
   
   MacOS 14.6 (23G80)
   
   ### Versions of Apache Airflow Providers
   
   I haven’t added any additional providers
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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