tvalentyn commented on a change in pull request #12927:
URL: https://github.com/apache/beam/pull/12927#discussion_r497830780
##########
File path: sdks/python/apache_beam/io/avroio.py
##########
@@ -627,11 +627,19 @@ def write_record(self, writer, value):
writer.append(value)
+class _FastAvroWriter(Writer):
+ """An adapter class which exposes a file handle so that it can be closed
+ by the sink. """
+ def __init__(self, file_handle, schema, codec):
+ super(_FastAvroWriter, self).__init__(file_handle, schema, codec)
Review comment:
Let's do the following:
1. File a JIRA for this issue, mention in the the error message that you
observed. Let's mention in the JIRA the workaround (install cython or
downgrade fastavro to 0.21.24) in case users discover this error.
2. Add a workaround in code:
```
try:
writer.fo.close()
except AttributeError:
# We can clean this up after fastavro lower bound includes a fix for
https://github.com/fastavro/fastavro/issues/472.
writer.encoder.close()
```
3. Test that the workaround works.
Thanks for spotting this. How did you catch it by the way? Was it a unit
test failure that occurred locally? I wonder why our non-cython test suite does
not catch it.
----------------------------------------------------------------
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]