MCPcopy Create free account
hub / github.com/apache/arrow / ORCWriter

Class ORCWriter

python/pyarrow/orc.py:224–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222
223
224class ORCWriter:
225 __doc__ = f"""
226Writer interface for a single ORC file
227
228Parameters
229----------
230where : str or pyarrow.io.NativeFile
231 Writable target. For passing Python file objects or byte buffers,
232 see pyarrow.io.PythonFileInterface, pyarrow.io.BufferOutputStream
233 or pyarrow.io.FixedSizeBufferWriter.
234{_orc_writer_args_docs}
235"""
236
237 is_open = False
238
239 def __init__(self, where, *,
240 file_version='0.12',
241 batch_size=1024,
242 stripe_size=64 * 1024 * 1024,
243 compression='uncompressed',
244 compression_block_size=65536,
245 compression_strategy='speed',
246 row_index_stride=10000,
247 padding_tolerance=0.0,
248 dictionary_key_size_threshold=0.0,
249 bloom_filter_columns=None,
250 bloom_filter_fpp=0.05,
251 ):
252 self.writer = _orc.ORCWriter()
253 self.writer.open(
254 where,
255 file_version=file_version,
256 batch_size=batch_size,
257 stripe_size=stripe_size,
258 compression=compression,
259 compression_block_size=compression_block_size,
260 compression_strategy=compression_strategy,
261 row_index_stride=row_index_stride,
262 padding_tolerance=padding_tolerance,
263 dictionary_key_size_threshold=dictionary_key_size_threshold,
264 bloom_filter_columns=bloom_filter_columns,
265 bloom_filter_fpp=bloom_filter_fpp
266 )
267 self.is_open = True
268
269 def __del__(self):
270 self.close()
271
272 def __enter__(self):
273 return self
274
275 def __exit__(self, *args, **kwargs):
276 self.close()
277
278 def write(self, table):
279 """
280 Write the table into an ORC file. The schema of the table must
281 be equal to the schema used when opening the ORC file.

Callers 1

write_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected