pabloem commented on a change in pull request #15357:
URL: https://github.com/apache/beam/pull/15357#discussion_r694296637



##########
File path: sdks/python/apache_beam/io/iobase.py
##########
@@ -1573,15 +1581,28 @@ def is_bounded(self):
     return True
 
 
+class _RestrictionCoder(coders.Coder):
+  def decode(self, value):
+    return _SDFBoundedSourceRestriction(SourceBundle(*pickler.loads(value)))
+
+  def encode(self, restriction):
+    return pickler.dumps((

Review comment:
       okay - we're currently using pickler. does that lg?

##########
File path: sdks/python/apache_beam/io/iobase.py
##########
@@ -886,12 +888,18 @@ def get_desired_chunk_size(total_size):
 
   def expand(self, pbegin):
     if isinstance(self.source, BoundedSource):
+      coders.registry.register_coder(BoundedSource, _MemoizingPickleCoder)
       display_data = self.source.display_data() or {}
       display_data['source'] = self.source.__class__
+
+      def output_source(_) -> BoundedSource:
+        assert isinstance(self.source, BoundedSource)
+        return self.source
+
       return (
           pbegin
           | Impulse()
-          | core.Map(lambda _: self.source)
+          | core.Map(output_source)

Review comment:
       done. 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to