uranusjr commented on code in PR #67716: URL: https://github.com/apache/airflow/pull/67716#discussion_r3378460545
########## task-sdk/src/airflow/sdk/definitions/partition_mappers/fixed_key.py: ########## @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from airflow.sdk.definitions.partition_mappers.base import PartitionMapper + + +class FixedKeyMapper(PartitionMapper): + """ + Collapse every upstream partition key onto one fixed downstream key. + + Authoring marker for the scheduler-side + :class:`airflow.partition_mappers.fixed_key.FixedKeyMapper`. Paired with + :class:`~airflow.sdk.definitions.partition_mappers.window.SegmentWindow` inside a + :class:`~airflow.sdk.definitions.partition_mappers.base.RollupMapper` to express a + categorical rollup. + + Construction validates *downstream_key* so Dag parse errors surface + immediately rather than deferring to scheduler deserialization. + + :param downstream_key: The fixed downstream partition key every upstream key + maps to. Must be a non-empty string. + :raises ValueError: if *downstream_key* is not a non-empty ``str``. + """ + + def __init__(self, downstream_key: str) -> None: Review Comment: Same, using attrs is a lot easier. Also this needs a way to be kept in sync with core. -- 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]
