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/03 20:15:15 UTC

[GitHub] [beam] kennknowles opened a new issue, #18712: DoFn.process should raise exception if something other than a List is returned

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

   The process method of DoFns can either return values or yield values. In the case of returning values, it expects a List of elements to be returned. When returning a single value, it is easy to forget this, and return the value instead.
   
   Correct way:
   
   `class SomeDoFn(beam.DoFn)`
    `  def process(self, elem):`
    `    return ['a']`
   
   Incorrect way:
   
   `class SomeDoFn(beam.DoFn)`
    `  def process(self, elem):`
    `    return 'a'`
   
   A pipeline with the incorrect DoFn will fail will a cryptic error message without a direct indication that the actual error is due to SomeDoFn returning an element instead of a List containing that element. This issue is very time-consuming to track down.
   
   It would be good if the pipeline could raise an exception or otherwise indicate that the DoFn is incorrectly returning an element instead of a List to make it easier to identify the error.
   
   Imported from Jira [BEAM-3530](https://issues.apache.org/jira/browse/BEAM-3530). Original Jira may contain additional context.
   Reported by: chuanyu.


-- 
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


[GitHub] [beam] toransahu commented on issue #18712: DoFn.process should raise exception if something other than a List is returned

Posted by GitBox <gi...@apache.org>.
toransahu commented on issue #18712:
URL: https://github.com/apache/beam/issues/18712#issuecomment-1232859822

   FYI, other behavioral issue observed with `DoFn.process` is : https://github.com/apache/beam/issues/22969


-- 
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

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


[GitHub] [beam] kennknowles commented on issue #18712: DoFn.process should raise exception if something other than a List is returned

Posted by GitBox <gi...@apache.org>.
kennknowles commented on issue #18712:
URL: https://github.com/apache/beam/issues/18712#issuecomment-1272124476

   @tvalentyn @robertwb do type hints not catch this?


-- 
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

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