Vamsi-klu commented on code in PR #68150:
URL: https://github.com/apache/airflow/pull/68150#discussion_r3688695653
##########
airflow-core/src/airflow/partition_mappers/base.py:
##########
@@ -173,9 +173,13 @@ def to_downstream(self, key: str) -> str | Iterable[str]:
def to_upstream(self, downstream_key: str) -> frozenset[str]:
"""Return the complete set of upstream partition keys required for
*downstream_key*."""
decoded = self.upstream_mapper.decode_downstream(downstream_key)
+ # Hand the upstream mapper's timezone to the window so calendar
windows (DayWindow) can
+ # enumerate the real local hours across DST. Non-temporal mappers have
no tzinfo -> None,
+ # in which case the window falls back to its fixed-count (UTC)
behaviour.
+ tz = getattr(self.upstream_mapper, "tzinfo", None)
return frozenset(
self.upstream_mapper.encode_upstream(expected_upstream)
- for expected_upstream in self.window.to_upstream(decoded)
+ for expected_upstream in self.window.to_upstream(decoded, tz)
Review Comment:
Addressed without **kwargs or signature sniffing:
- Window.to_upstream stays the stable one-arg abstract contract.
- New Window.to_upstream_tz(decoded, tz) defaults to to_upstream(decoded).
- DayWindow overrides to_upstream_tz; RollupMapper always calls
to_upstream_tz.
Custom subclasses that only implement to_upstream(self, decoded) keep
working.
##########
airflow-core/src/airflow/partition_mappers/base.py:
##########
@@ -173,9 +173,13 @@ def to_downstream(self, key: str) -> str | Iterable[str]:
def to_upstream(self, downstream_key: str) -> frozenset[str]:
"""Return the complete set of upstream partition keys required for
*downstream_key*."""
decoded = self.upstream_mapper.decode_downstream(downstream_key)
+ # Hand the upstream mapper's timezone to the window so calendar
windows (DayWindow) can
+ # enumerate the real local hours across DST. Non-temporal mappers have
no tzinfo -> None,
+ # in which case the window falls back to its fixed-count (UTC)
behaviour.
+ tz = getattr(self.upstream_mapper, "tzinfo", None)
Review Comment:
Done — PartitionMapper.tzinfo is now an explicit base property returning
None; temporal mappers override it. RollupMapper uses
self.upstream_mapper.tzinfo directly (no getattr). Mirrored into the Task SDK
base as well.
--
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]