You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 12:32:41 UTC

[GitHub] [beam] damccorm opened a new issue, #19631: DoFn invocation has wrong argument assignment

damccorm opened a new issue, #19631:
URL: https://github.com/apache/beam/issues/19631

   I've added this test to DoFnProcessTest:
   ```
   
       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))
   
   ```
   
   
   The print output is:
   ```
   
   element=5 timestamp=2 side_input=Timestamp(-9223372036854.775000)
   
   ```
   
   
   If the default value for `element` is removed:
   ```
   
   element=5 timestamp=Timestamp(-9223372036854.775000) side_input=2
   
   ```
   
   
   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]
   
   Imported from Jira [BEAM-7867](https://issues.apache.org/jira/browse/BEAM-7867). Original Jira may contain additional context.
   Reported by: udim.


-- 
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: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org