3333from typing import Callable
3434from typing import Iterable
3535from typing import List
36- from typing import Optional
3736from typing import Tuple
3837from typing import TypeVar
3938from typing import Union
7473from apache_beam .transforms .window import TimestampedValue
7574from apache_beam .typehints import trivial_inference
7675from apache_beam .typehints .decorators import get_signature
77- from apache_beam .typehints .native_type_compatibility import TypedWindowedValue
7876from apache_beam .typehints .sharded_key_type import ShardedKeyType
7977from apache_beam .utils import shared
8078from apache_beam .utils import windowed_value
8179from apache_beam .utils .annotations import deprecated
8280from apache_beam .utils .sharded_key import ShardedKey
83- from apache_beam .utils .timestamp import Timestamp
8481
8582if TYPE_CHECKING :
8683 from apache_beam .runners .pipeline_context import PipelineContext
@@ -956,10 +953,6 @@ def restore_timestamps(element):
956953 window .GlobalWindows .windowed_value ((key , value ), timestamp )
957954 for (value , timestamp ) in values
958955 ]
959-
960- ungrouped = pcoll | Map (reify_timestamps ).with_input_types (
961- Tuple [K , V ]).with_output_types (
962- Tuple [K , Tuple [V , Optional [Timestamp ]]])
963956 else :
964957
965958 # typing: All conditional function variants must have identical signatures
@@ -973,8 +966,7 @@ def restore_timestamps(element):
973966 key , windowed_values = element
974967 return [wv .with_value ((key , wv .value )) for wv in windowed_values ]
975968
976- ungrouped = pcoll | Map (reify_timestamps ).with_input_types (
977- Tuple [K , V ]).with_output_types (Tuple [K , TypedWindowedValue [V ]])
969+ ungrouped = pcoll | Map (reify_timestamps ).with_output_types (Any )
978970
979971 # TODO(https://github.com/apache/beam/issues/19785) Using global window as
980972 # one of the standard window. This is to mitigate the Dataflow Java Runner
@@ -1026,8 +1018,7 @@ def expand(self, pcoll):
10261018 pcoll | 'AddRandomKeys' >>
10271019 Map (lambda t : (random .randrange (0 , self .num_buckets ), t )
10281020 ).with_input_types (T ).with_output_types (Tuple [int , T ])
1029- | ReshufflePerKey ().with_input_types (Tuple [int , T ]).with_output_types (
1030- Tuple [int , T ])
1021+ | ReshufflePerKey ()
10311022 | 'RemoveRandomKeys' >> Map (lambda t : t [1 ]).with_input_types (
10321023 Tuple [int , T ]).with_output_types (T ))
10331024
0 commit comments