[
https://issues.apache.org/jira/browse/BEAM-5879?focusedWorklogId=163380&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-163380
]
ASF GitHub Bot logged work on BEAM-5879:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Nov/18 08:50
Start Date: 07/Nov/18 08:50
Worklog Time Spent: 10m
Work Description: robertwb closed pull request #6953: [BEAM-5879 ] Make
write_record() in tfrecordio.py py3 compatible
URL: https://github.com/apache/beam/pull/6953
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/sdks/python/apache_beam/io/tfrecordio.py
b/sdks/python/apache_beam/io/tfrecordio.py
index fc578d9bbd3..fa527c73874 100644
--- a/sdks/python/apache_beam/io/tfrecordio.py
+++ b/sdks/python/apache_beam/io/tfrecordio.py
@@ -95,12 +95,13 @@ def write_record(cls, file_handle, value):
file_handle: The file to write to.
value: A string content of the record.
"""
- encoded_length = struct.pack('<Q', len(value))
- file_handle.write('{}{}{}{}'.format(
+ encoded_length = struct.pack(b'<Q', len(value))
+ file_handle.write(b''.join([
encoded_length,
- struct.pack('<I', cls._masked_crc32c(encoded_length)), #
+ struct.pack(b'<I', cls._masked_crc32c(encoded_length)),
value,
- struct.pack('<I', cls._masked_crc32c(value))))
+ struct.pack(b'<I', cls._masked_crc32c(value))
+ ]))
@classmethod
def read_record(cls, file_handle):
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 163380)
Time Spent: 1h 50m (was: 1h 40m)
> TFRecordio not Py3 compatible
> -----------------------------
>
> Key: BEAM-5879
> URL: https://issues.apache.org/jira/browse/BEAM-5879
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-py-core
> Environment: python 3.5
> Reporter: Ruoyu Liu
> Priority: Major
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> Error when trying to write to file. Initial issue in line 103 in
> io/tfrecordio.py, after making the content to bytes, there will be
> segmentation fault when reading.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)