uranusjr commented on code in PR #60204:
URL: https://github.com/apache/airflow/pull/60204#discussion_r2689847305
##########
airflow-core/src/airflow/serialization/encoders.py:
##########
@@ -347,3 +364,41 @@ def ensure_serialized_asset(obj: BaseAsset |
SerializedAssetBase) -> SerializedA
from airflow.serialization.decoders import decode_asset_like
return decode_asset_like(encode_asset_like(obj))
+
+
+class _PartitionMapperSerializer:
+ BUILTIN_PARTITION_MAPPERS: dict[type, str] = {
+ IdentityMapper: "airflow.timetables.simple.IdentityMapper",
+ }
+
+ @functools.singledispatchmethod
+ def serialize(self, partition_mapper: PartitionMapper) -> dict[str, Any]:
+ raise NotImplementedError
+
+ @serialize.register
+ def _(self, partition_mapper: IdentityMapper) -> dict[str, Any]:
+ return {}
Review Comment:
The serializer-singledispatch pattern is only needed for timetables because
we don’t want to put serialization logic on SDK classes. Since the partition
mapper logic is only in core, we can put serialization logic there.
--
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]