nathadfield commented on code in PR #67285: URL: https://github.com/apache/airflow/pull/67285#discussion_r3387653975
########## airflow-core/src/airflow/assets/manager.py: ########## @@ -63,6 +66,47 @@ log = structlog.get_logger(__name__) +def _compute_target_partition_date( + *, + mapper: PartitionMapper, + source_partition_key: str, + source_partition_date: datetime | None, +) -> datetime | None: + """ + Derive the consumer's ``partition_date`` from the partition mapper. + + Computed once at APDR creation and stored on the row, so the consumer + DagRun's ``partition_date`` is locked to the mapper output at the time + the source event was queued — later mapper code or config changes do + not retroactively shift the date. + + - ``RollupMapper``: ``None``. A rollup collapses many upstream partitions + (each with its own date) into one downstream partition, so no single + source ``partition_date`` describes the rolled-up window. + - ``IdentityMapper``: passes the source ``partition_date`` through. + - ``_BaseTemporalMapper`` subclasses (``StartOf*Mapper``): re-parse the + source key with the mapper's ``input_format`` and apply ``normalize``. + - All other mappers: ``None``. + """ + from airflow.partition_mappers.base import is_rollup Review Comment: Done! -- 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]
