[
https://issues.apache.org/jira/browse/ARROW-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16312433#comment-16312433
]
ASF GitHub Bot commented on ARROW-1919:
---------------------------------------
wesm closed pull request #1421: ARROW-1919: [Plasma] Test that object ids are
20 bytes
URL: https://github.com/apache/arrow/pull/1421
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/python/pyarrow/plasma.pyx b/python/pyarrow/plasma.pyx
index f2e8653d8..969aa15fe 100644
--- a/python/pyarrow/plasma.pyx
+++ b/python/pyarrow/plasma.pyx
@@ -136,6 +136,9 @@ cdef class ObjectID:
CUniqueID data
def __cinit__(self, object_id):
+ if not isinstance(object_id, bytes) or len(object_id) != 20:
+ raise ValueError("Object ID must by 20 bytes,"
+ " is " + str(object_id))
self.data = CUniqueID.from_binary(object_id)
def __richcmp__(ObjectID self, ObjectID object_id, operation):
diff --git a/python/pyarrow/tests/test_plasma.py
b/python/pyarrow/tests/test_plasma.py
index b28bd60c4..ec5d04d19 100644
--- a/python/pyarrow/tests/test_plasma.py
+++ b/python/pyarrow/tests/test_plasma.py
@@ -360,7 +360,7 @@ def test_store_pandas_dataframe(self):
# Read the DataFrame.
[data] = self.plasma_client.get_buffers([object_id])
reader = pa.RecordBatchStreamReader(pa.BufferReader(data))
- result = reader.get_next_batch().to_pandas()
+ result = reader.read_next_batch().to_pandas()
pd.util.testing.assert_frame_equal(df, result)
@@ -745,3 +745,11 @@ def test_use_one_memory_mapped_file(self):
with pytest.raises(pa.lib.PlasmaStoreFull):
create_object(self.plasma_client, DEFAULT_PLASMA_STORE_MEMORY + 1,
0)
+
+
[email protected]
+def test_object_id_size():
+ import pyarrow.plasma as plasma
+ with pytest.raises(ValueError):
+ plasma.ObjectID("hello")
+ plasma.ObjectID(20 * b"0")
----------------------------------------------------------------
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]
> Plasma hanging if object id is not 20 bytes
> -------------------------------------------
>
> Key: ARROW-1919
> URL: https://issues.apache.org/jira/browse/ARROW-1919
> Project: Apache Arrow
> Issue Type: Bug
> Reporter: Philipp Moritz
> Assignee: Philipp Moritz
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
> This happens if plasma's capability to put an object with a user defined
> object id is used if the object id is not 20 bytes long. Plasma will hang
> upon get in that case, we should give an error instead.
> See https://github.com/ray-project/ray/issues/1315
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)