[ 
https://issues.apache.org/jira/browse/BEAM-14213?focusedWorklogId=756726&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-756726
 ]

ASF GitHub Bot logged work on BEAM-14213:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Apr/22 21:40
            Start Date: 13/Apr/22 21:40
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on code in PR #17253:
URL: https://github.com/apache/beam/pull/17253#discussion_r849921374


##########
sdks/python/apache_beam/transforms/batch_dofn_test.py:
##########
@@ -0,0 +1,123 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""UnitTests for Batched DoFn (process_batch) API."""
+
+# pytype: skip-file
+
+import unittest
+from typing import Iterator
+from typing import List
+from typing import NamedTuple
+from typing import Optional
+
+from parameterized import parameterized_class
+
+import apache_beam as beam
+
+
+class ElementDoFn(beam.DoFn):
+  def process(self, element: int, *args, **kwargs) -> Iterator[int]:
+    yield element
+
+
+class BatchDoFn(beam.DoFn):
+  def process_batch(self, batch: List[int], *args,
+                    **kwargs) -> Iterator[List[int]]:
+    yield [element * 2 for element in batch]

Review Comment:
   I wrote this up 
[here](https://docs.google.com/document/d/1Xt7T0e_TEJrCCx9DnUBY60zrysRHDw6mPBAcc-e9UHo/edit#).
 This was a useful exercise, but in the end I'm inclined to keep it as-is 
(although I'm open to changing it if a strong case is made). I'll send this out 
to the dev list.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 756726)
    Time Spent: 1h 40m  (was: 1.5h)

> Add support for Batched DoFns in the Python SDK
> -----------------------------------------------
>
>                 Key: BEAM-14213
>                 URL: https://issues.apache.org/jira/browse/BEAM-14213
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Brian Hulette
>            Assignee: Brian Hulette
>            Priority: P2
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Add an implementation for https://s.apache.org/batched-dofns to the Python 
> SDK.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to