apache / apache/beam

Wrong process function arg order cause unexpected runtime value shift

Open
#20,942 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

if kw args of process function are declared before DnFnParam placeholders the fulfillment will shift to wrong index unexpectedly.

For example if process has signature
```

 def process(element, an_arg='x', w=DoFn.WindowParam):
window_start_1 = an_arg.start // this is
ok, though unexpectedly
window_start_2 = w.start // this is not ok, also unexpectedly, value of
w is shifted onto an_arg, and w is DoFn.WindowParam, it throws exception _DoFnParam has no attribute
'start'.

...
```

at runtime the window param will be mapped onto 'an_arg' instead of w, and w will not be replaced with runtime value, causing confusing behaviors. (e.g. an_arg will be an instance of GlobalWindow or FixedWindow but w is still DoFn.WindowParam).

Imported from Jira [BEAM-12446](https://issues.apache.org/jira/browse/BEAM-12446). Original Jira may contain additional context.
Reported by: yichi.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.