AlenkaF commented on a change in pull request #11724:
URL: https://github.com/apache/arrow/pull/11724#discussion_r759107140
##########
File path: python/pyarrow/_parquet.pyx
##########
@@ -880,6 +880,21 @@ cdef encoding_name_from_enum(ParquetEncoding encoding_):
}.get(encoding_, 'UNKNOWN')
+cdef encoding_enum_from_name(str encoding_name):
+ enc = {
+ 'PLAIN': ParquetEncoding_PLAIN,
+ 'BIT_PACKED': ParquetEncoding_BIT_PACKED,
+ 'RLE': ParquetEncoding_RLE,
+ 'BYTE_STREAM_SPLIT': ParquetEncoding_BYTE_STREAM_SPLIT,
+ 'DELTA_BINARY_PACKED': ParquetEncoding_DELTA_BINARY_PACKED,
+ 'DELTA_BYTE_ARRAY': ParquetEncoding_DELTA_BYTE_ARRAY,
+ }.get(encoding_name, None)
+ if enc is None:
+ raise ValueError(f"Unsupported column encoding: {encoding_name!r}")
Review comment:
What if I do something like this:
```
cdef encoding_enum_from_name(str encoding_name):
enc = {
'PLAIN': ParquetEncoding_PLAIN,
'BIT_PACKED': ParquetEncoding_BIT_PACKED,
'RLE': ParquetEncoding_RLE,
'BYTE_STREAM_SPLIT': ParquetEncoding_BYTE_STREAM_SPLIT,
'DELTA_BINARY_PACKED': ParquetEncoding_DELTA_BINARY_PACKED,
'DELTA_BYTE_ARRAY': ParquetEncoding_DELTA_BYTE_ARRAY,
'RLE_DICTIONARY': 'dict',
'PLAIN_DICTIONARY': 'dict',
}.get(encoding_name, None)
if enc is None:
raise ValueError(f"Unsupported column encoding: {encoding_name!r}")
elif enc == 'dict':
raise ValueError(f"{encoding_name!r} is already used by default.")
else:
return enc
```
--
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]