aaltay commented on code in PR #17708:
URL: https://github.com/apache/beam/pull/17708#discussion_r886978117


##########
sdks/python/apache_beam/io/fileio.py:
##########
@@ -525,8 +526,11 @@ def __init__(
   @staticmethod
   def _get_sink_fn(input_sink):
     # type: (...) -> Callable[[Any], FileSink]
-    if isinstance(input_sink, FileSink):
-      return lambda x: input_sink
+    if isinstance(input_sink, type) and issubclass(input_sink, FileSink):
+      return lambda x: input_sink()
+    elif isinstance(input_sink, FileSink):
+      kls = input_sink.__class__
+      return lambda x: kls()
     elif callable(input_sink):
       return input_sink
     else:

Review Comment:
   This is also a bit odd. Description says if none is provided (and clearly 
does not say `None`) a TextSink will be used. This follows the letter but not 
the spirit of the description. A user can pass "MyNewSink()" and it will result 
in using TextSink in an unexpected way. (This could be fixed later.)



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