-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed
Labels
affected_version:3.0Issues Reported for 3.0Issues Reported for 3.0affected_version:main_branchIssues Reported for main branchIssues Reported for main brancharea:corearea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release
Milestone
Description
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.
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
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
affected_version:3.0Issues Reported for 3.0Issues Reported for 3.0affected_version:main_branchIssues Reported for main branchIssues Reported for main brancharea:corearea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new releaseHigh priority bug that should be patched quickly but does not require immediate new release