udim commented on a change in pull request #14834:
URL: https://github.com/apache/beam/pull/14834#discussion_r634791008



##########
File path: sdks/python/apache_beam/transforms/create_test.py
##########
@@ -121,6 +123,43 @@ def test_create_source_progress(self):
 
     self.assertEqual(expected_split_points_report, split_points_report)
 
+  def test_create_uses_coder_for_pickling(self):
+    coders.registry.register_coder(_Unpicklable, _UnpicklableCoder)
+    create = Create([_Unpicklable(1), _Unpicklable(2), _Unpicklable(3)])
+    unpickled_create = pickler.loads(pickler.dumps(create))
+    self.assertEqual(
+        sorted(create.values, key=lambda v: v.value),
+        sorted(unpickled_create.values, key=lambda v: v.value))
+
+    with self.assertRaises(NotImplementedError):
+      create_unpicklable = Create([_Unpicklable(1), 2])

Review comment:
       Why is this unpicklable? I don't understand why _UnpicklableCoder isn't 
used here as well. Is this using FastPrimitivesCoder instead on a 
Union[_Unpicklable, int]?
   
   In any case, please add a comment explaining the difference.




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

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


Reply via email to