iajoiner commented on a change in pull request #9702:
URL: https://github.com/apache/arrow/pull/9702#discussion_r758913156
##########
File path: python/pyarrow/_orc.pyx
##########
@@ -38,6 +38,283 @@ from pyarrow.lib cimport (check_status, _Weakrefable,
get_writer)
from pyarrow.lib import tobytes
+cdef compression_kind_from_enum(CompressionKind compression_kind_):
+ return {
+ _CompressionKind_NONE: 'NONE',
+ _CompressionKind_ZLIB: 'ZLIB',
+ _CompressionKind_SNAPPY: 'SNAPPY',
+ _CompressionKind_LZO: 'LZO',
+ _CompressionKind_LZ4: 'LZ4',
+ _CompressionKind_ZSTD: 'ZSTD',
+ }.get(compression_kind_, 'UNKNOWN')
+
+cdef CompressionKind compression_kind_from_name(name):
+ name = name.upper()
+ if name == 'ZLIB':
+ return _CompressionKind_ZLIB
+ elif name == 'SNAPPY':
+ return _CompressionKind_SNAPPY
+ elif name == 'LZO':
+ return _CompressionKind_LZO
+ elif name == 'LZ4':
+ return _CompressionKind_LZ4
+ elif name == 'ZSTD':
+ return _CompressionKind_ZSTD
+ else:
+ return _CompressionKind_NONE
+
+cdef compression_strategy_from_enum(CompressionStrategy compression_strategy_):
+ return {
+ _CompressionStrategy_SPEED: 'SPEED',
+ _CompressionStrategy_COMPRESSION: 'COMPRESSION',
+ }.get(compression_strategy_, 'UNKNOWN')
+
+cdef CompressionStrategy compression_strategy_from_name(name):
+ name = name.upper()
+ # SPEED is the default value in the ORC C++ implementaton
+ if name == 'COMPRESSION':
+ return _CompressionStrategy_COMPRESSION
+ else:
+ return _CompressionStrategy_SPEED
+
+cdef rle_version_from_enum(RleVersion rle_version_):
+ return {
+ _RleVersion_1: '1',
+ _RleVersion_2: '2',
+ }.get(rle_version_, 'UNKNOWN')
+
+cdef bloom_filter_version_from_enum(BloomFilterVersion bloom_filter_version_):
+ return {
+ _BloomFilterVersion_ORIGINAL: 'ORIGINAL',
+ _BloomFilterVersion_UTF8: 'UTF8',
+ _BloomFilterVersion_FUTURE: 'FUTURE',
+ }.get(bloom_filter_version_, 'UNKNOWN')
+
+cdef file_version_from_class(FileVersion file_version_):
+ cdef object file_version = file_version_.ToString()
+ return file_version
+
+cdef class ORCWriterOptions(_Weakrefable):
+ cdef:
+ unique_ptr[WriterOptions] options
Review comment:
I wonder whether people would enjoy having `WriteOptions` as a Python
class. I know that the CSV writer has it while the Parquet one doesn't so I'm
conflicted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]