Udi Meiri created BEAM-7867:
-------------------------------
Summary: DoFn invocation has wrong argument assignment
Key: BEAM-7867
URL: https://issues.apache.org/jira/browse/BEAM-7867
Project: Beam
Issue Type: Bug
Components: sdk-py-core
Reporter: Udi Meiri
I've added this test to DoFnProcessTest:
{code}
class DoFnProcessAllDefaults(DoFn):
def process(self, element=1, timestamp=DoFn.TimestampParam, side_input=3):
print('element={} timestamp={} side_input={}'.format(
element, timestamp, side_input))
pipeline_options = PipelineOptions()
with TestPipeline(options=pipeline_options) as p:
_ = (p
| beam.Create([5])
| beam.ParDo(DoFnProcessAllDefaults(), 2))
{code}
The print output is:
{code}
element=5 timestamp=2 side_input=Timestamp(-9223372036854.775000)
{code}
If the default value for `element` is removed:
{code}
element=5 timestamp=Timestamp(-9223372036854.775000) side_input=2
{code}
Bug is in PerWindowInvoker.__init__, found while working on type hints related
code.
The issue is with args_to_pick, which goes to -1 in the first case.
Note that prototypes like process(element=1) and process(element=1,
timestamp=DoFn.TimestampParam) work fine, so there could be existing pipelines
that have such process() methods.
[~robertwb][~altay]
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)