1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# distutils: language = c++
# cython: language_level = 3
from pyarrow.includes.libparquet cimport *
from pyarrow.lib cimport _Weakrefable
cdef class FileEncryptionProperties:
"""File-level encryption properties for the low-level API"""
cdef:
shared_ptr[CFileEncryptionProperties] properties
@staticmethod
cdef inline FileEncryptionProperties wrap(
shared_ptr[CFileEncryptionProperties] properties):
result = FileEncryptionProperties()
result.properties = properties
return result
cdef inline shared_ptr[CFileEncryptionProperties] unwrap(self):
return self.properties
cdef shared_ptr[WriterProperties] _create_writer_properties(
use_dictionary=*,
compression=*,
version=*,
write_statistics=*,
data_page_size=*,
max_rows_per_page=*,
compression_level=*,
use_byte_stream_split=*,
column_encoding=*,
data_page_version=*,
FileEncryptionProperties encryption_properties=*,
write_batch_size=*,
dictionary_pagesize_limit=*,
write_page_index=*,
write_page_checksum=*,
sorting_columns=*,
store_decimal_as_integer=*,
use_content_defined_chunking=*
) except *
cdef shared_ptr[ArrowWriterProperties] _create_arrow_writer_properties(
use_deprecated_int96_timestamps=*,
coerce_timestamps=*,
allow_truncated_timestamps=*,
writer_engine_version=*,
use_compliant_nested_type=*,
store_schema=*,
write_time_adjusted_to_utc=*,
) except *
# Unwrap the "list_type" argument for ArrowReaderProperties
cdef Type _unwrap_list_type(obj) except *
cdef class ParquetSchema(_Weakrefable):
cdef:
FileMetaData parent # the FileMetaData owning the SchemaDescriptor
const SchemaDescriptor* schema
cdef class FileMetaData(_Weakrefable):
cdef:
shared_ptr[CFileMetaData] sp_metadata
CFileMetaData* _metadata
ParquetSchema _schema
cdef inline init(self, const shared_ptr[CFileMetaData]& metadata):
self.sp_metadata = metadata
self._metadata = metadata.get()
cdef class RowGroupMetaData(_Weakrefable):
cdef:
int index # for pickling support
unique_ptr[CRowGroupMetaData] up_metadata
CRowGroupMetaData* metadata
FileMetaData parent
cdef inline init(self, FileMetaData parent, int index):
if index < 0 or index >= parent.num_row_groups:
raise IndexError('{0} out of bounds'.format(index))
self.up_metadata = parent._metadata.RowGroup(index)
self.metadata = self.up_metadata.get()
self.parent = parent
self.index = index
cdef class ColumnChunkMetaData(_Weakrefable):
cdef:
unique_ptr[CColumnChunkMetaData] up_metadata
CColumnChunkMetaData* metadata
RowGroupMetaData parent
cdef inline init(self, RowGroupMetaData parent, int i):
self.up_metadata = parent.metadata.ColumnChunk(i)
self.metadata = self.up_metadata.get()
self.parent = parent
cdef class Statistics(_Weakrefable):
cdef:
shared_ptr[CStatistics] statistics
ColumnChunkMetaData parent
cdef inline init(self, const shared_ptr[CStatistics]& statistics,
ColumnChunkMetaData parent):
self.statistics = statistics
self.parent = parent
cdef class GeoStatistics(_Weakrefable):
cdef:
shared_ptr[CParquetGeoStatistics] statistics
ColumnChunkMetaData parent
cdef inline init(self, const shared_ptr[CParquetGeoStatistics]& statistics,
ColumnChunkMetaData parent):
self.statistics = statistics
self.parent = parent
cdef class FileDecryptionProperties:
"""File-level decryption properties for the low-level API"""
cdef:
shared_ptr[CFileDecryptionProperties] properties
@staticmethod
cdef inline FileDecryptionProperties wrap(
shared_ptr[CFileDecryptionProperties] properties):
result = FileDecryptionProperties()
result.properties = properties
return result
cdef inline shared_ptr[CFileDecryptionProperties] unwrap(self):
return self.properties
|