-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Description
What happened?
This bug is seen on apache-beam==2.63.0, python 3.11
Constructing a simple pipeline where a function with an additional, optional arg is a UnionType with the pipe operator results in the following exception
import apache_beam as beam
def func(x: int, y: int | None = None):
return x
with beam.Pipeline() as p:
(p
| beam.Create([1])
| beam.Map(func))Traceback (most recent call last):
File "/Users/chintala/Downloads/./test.py", line 9, in <module>
(p
^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/pvalue.py", line 138, in __or__
return self.pipeline.apply(ptransform, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/pipeline.py", line 781, in apply
transform.type_check_inputs(pvalueish)
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/transforms/ptransform.py", line 960, in type_check_inputs
if not typehints.is_consistent_with(bindings.get(arg, typehints.Any),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/typehints/typehints.py", line 1317, in is_consistent_with
return base._consistent_with_check_(sub)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/typehints/typehints.py", line 536, in _consistent_with_check_
return any(is_consistent_with(sub, elem) for elem in self.union_types)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/typehints/typehints.py", line 536, in <genexpr>
return any(is_consistent_with(sub, elem) for elem in self.union_types)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chintala/builds/master/build/internal/lib/python3.11/site-packages/apache_beam/typehints/typehints.py", line 1323, in is_consistent_with
return issubclass(sub, base)
^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 1 must be a class
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
- Component: Python SDK
- Component: Java SDK
- Component: Go SDK
- Component: Typescript SDK
- Component: IO connector
- Component: Beam YAML
- Component: Beam examples
- Component: Beam playground
- Component: Beam katas
- Component: Website
- Component: Infrastructure
- Component: Spark Runner
- Component: Flink Runner
- Component: Samza Runner
- Component: Twister2 Runner
- Component: Hazelcast Jet Runner
- Component: Google Cloud Dataflow Runner
Reactions are currently unavailable