mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 00:56:31 +08:00
Adapt Python bindings
This commit is contained in:
1 parent
769974a6e7
commit
4c40bf2e1c
3 files changed
+11
-13
No files matched your search
@@ -24,7 +24,9 @@
|
||||
#include "parquet/exception.h"
|
||||
#include "parquet/file_reader.h"
|
||||
#include "parquet/metadata.h"
|
||||
#include "parquet/platform.h"
|
||||
#include "parquet/printer.h"
|
||||
#include "parquet/properties.h"
|
||||
|
||||
// Schemas
|
||||
#include "parquet/api/schema.h"
|
||||
|
||||
@@ -229,7 +229,7 @@ cdef extern from "parquet/api/reader.h" namespace "parquet" nogil:
|
||||
unique_ptr[CRowGroupMetaData] RowGroup(int i)
|
||||
const SchemaDescriptor* schema()
|
||||
shared_ptr[const CKeyValueMetadata] key_value_metadata() const
|
||||
void WriteTo(ParquetOutputStream* dst) const
|
||||
void WriteTo(OutputStream* dst) const
|
||||
|
||||
cdef shared_ptr[CFileMetaData] CFileMetaData_Make \
|
||||
" parquet::FileMetaData::Make"(const void* serialized_metadata,
|
||||
@@ -253,13 +253,6 @@ cdef extern from "parquet/api/reader.h" namespace "parquet" nogil:
|
||||
|
||||
|
||||
cdef extern from "parquet/api/writer.h" namespace "parquet" nogil:
|
||||
cdef cppclass ParquetOutputStream" parquet::OutputStream":
|
||||
pass
|
||||
|
||||
cdef cppclass ParquetInMemoryOutputStream \
|
||||
" parquet::InMemoryOutputStream"(ParquetOutputStream):
|
||||
shared_ptr[CBuffer] GetBuffer()
|
||||
|
||||
cdef cppclass WriterProperties:
|
||||
cppclass Builder:
|
||||
Builder* version(ParquetVersion version)
|
||||
|
||||
@@ -31,7 +31,7 @@ from pyarrow.includes.libarrow cimport *
|
||||
from pyarrow.lib cimport (Buffer, Array, Schema,
|
||||
check_status,
|
||||
MemoryPool, maybe_unbox_memory_pool,
|
||||
Table,
|
||||
Table, NativeFile,
|
||||
pyarrow_wrap_chunked_array,
|
||||
pyarrow_wrap_schema,
|
||||
pyarrow_wrap_table,
|
||||
@@ -39,7 +39,8 @@ from pyarrow.lib cimport (Buffer, Array, Schema,
|
||||
NativeFile, get_reader, get_writer)
|
||||
|
||||
from pyarrow.compat import tobytes, frombytes
|
||||
from pyarrow.lib import ArrowException, NativeFile, _stringify_path
|
||||
from pyarrow.lib import (ArrowException, NativeFile, _stringify_path,
|
||||
BufferOutputStream)
|
||||
from pyarrow.util import indent
|
||||
|
||||
|
||||
@@ -421,11 +422,13 @@ cdef class FileMetaData:
|
||||
self._metadata = metadata.get()
|
||||
|
||||
def __reduce__(self):
|
||||
cdef ParquetInMemoryOutputStream sink
|
||||
cdef:
|
||||
NativeFile sink = BufferOutputStream()
|
||||
OutputStream* c_sink = sink.get_output_stream().get()
|
||||
with nogil:
|
||||
self._metadata.WriteTo(&sink)
|
||||
self._metadata.WriteTo(c_sink)
|
||||
|
||||
cdef Buffer buffer = pyarrow_wrap_buffer(sink.GetBuffer())
|
||||
cdef Buffer buffer = sink.getvalue()
|
||||
return _reconstruct_filemetadata, (buffer,)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
Reference in new issue
Block a user