mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
fix typos and move FixedSizeBufferOutputStream
This commit is contained in:
1 parent
e33443dd5a
commit
08f24a55aa
6 files changed
+16
-16
No files matched your search
@@ -225,7 +225,7 @@ In-Memory Object Store
|
||||
ObjectID
|
||||
PlasmaClient
|
||||
PlasmaBuffer
|
||||
MutablePlasmaBufferMutablePlasmaBuffer
|
||||
MutablePlasmaBuffer
|
||||
|
||||
.. currentmodule:: pyarrow.parquet
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ from pyarrow.lib import (null, bool_,
|
||||
Date32Value, Date64Value, TimestampValue)
|
||||
|
||||
from pyarrow.lib import (HdfsFile, NativeFile, PythonFile,
|
||||
FixedSizeBufferOutputStream,
|
||||
Buffer, BufferReader, BufferOutputStream,
|
||||
OSFile, MemoryMappedFile, memory_map,
|
||||
frombuffer,
|
||||
@@ -99,7 +100,6 @@ from pyarrow.ipc import (Message, MessageReader,
|
||||
open_file,
|
||||
serialize_pandas, deserialize_pandas)
|
||||
|
||||
|
||||
localfs = LocalFilesystem.get_instance()
|
||||
|
||||
|
||||
|
||||
@@ -563,8 +563,8 @@ cdef extern from "arrow/io/memory.h" namespace "arrow::io" nogil:
|
||||
CMockOutputStream()
|
||||
int64_t GetExtentBytesWritten()
|
||||
|
||||
cdef cppclass CFixedSizeBufferWrite" arrow::io::FixedSizeBufferWriter"(WriteableFile):
|
||||
CFixedSizeBufferWrite(const shared_ptr[CBuffer]& buffer)
|
||||
cdef cppclass CFixedSizeBufferWriter" arrow::io::FixedSizeBufferWriter"(WriteableFile):
|
||||
CFixedSizeBufferWriter(const shared_ptr[CBuffer]& buffer)
|
||||
|
||||
|
||||
cdef extern from "arrow/ipc/api.h" namespace "arrow::ipc" nogil:
|
||||
|
||||
@@ -473,6 +473,15 @@ cdef class OSFile(NativeFile):
|
||||
self.wr_file = <shared_ptr[OutputStream]> handle
|
||||
|
||||
|
||||
cdef class FixedSizeBufferOutputStream(NativeFile):
|
||||
|
||||
def __cinit__(self, Buffer buffer):
|
||||
self.wr_file.reset(new CFixedSizeBufferWriter(buffer.buffer))
|
||||
self.is_readable = 0
|
||||
self.is_writeable = 1
|
||||
self.is_open = True
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Arrow buffers
|
||||
|
||||
|
||||
@@ -28,21 +28,12 @@ from cpython.pycapsule cimport *
|
||||
|
||||
from pyarrow.lib cimport Buffer, MutableBuffer, NativeFile, check_status
|
||||
from pyarrow.includes.libarrow cimport (CMutableBuffer, CBuffer,
|
||||
CFixedSizeBufferWrite, CStatus)
|
||||
CFixedSizeBufferWriter, CStatus)
|
||||
|
||||
|
||||
PLASMA_WAIT_TIMEOUT = 2 ** 30
|
||||
|
||||
|
||||
cdef class FixedSizeBufferOutputStream(NativeFile):
|
||||
|
||||
def __cinit__(self, Buffer buffer):
|
||||
self.wr_file.reset(new CFixedSizeBufferWrite(buffer.buffer))
|
||||
self.is_readable = 0
|
||||
self.is_writeable = 1
|
||||
self.is_open = True
|
||||
|
||||
|
||||
cdef extern from "plasma/common.h" nogil:
|
||||
|
||||
cdef cppclass CUniqueID" plasma::UniqueID":
|
||||
|
||||
@@ -279,7 +279,7 @@ class TestPlasmaClient(object):
|
||||
tensor = pa.Tensor.from_numpy(data)
|
||||
data_size = pa.get_tensor_size(tensor)
|
||||
buf = self.plasma_client.create(object_id, data_size)
|
||||
stream = plasma.FixedSizeBufferOutputStream(buf)
|
||||
stream = pa.FixedSizeBufferOutputStream(buf)
|
||||
pa.write_tensor(tensor, stream)
|
||||
self.plasma_client.seal(object_id)
|
||||
# Read the arrow object.
|
||||
@@ -305,7 +305,7 @@ class TestPlasmaClient(object):
|
||||
object_id = plasma.ObjectID(np.random.bytes(20))
|
||||
|
||||
buf = self.plasma_client.create(object_id, data_size)
|
||||
stream = plasma.FixedSizeBufferOutputStream(buf)
|
||||
stream = pa.FixedSizeBufferOutputStream(buf)
|
||||
stream_writer = pa.RecordBatchStreamWriter(stream, record_batch.schema)
|
||||
stream_writer.write_batch(record_batch)
|
||||
|
||||
|
||||
Reference in new issue
Block a user