pitrou commented on a change in pull request #8457:
URL: https://github.com/apache/arrow/pull/8457#discussion_r505684699
##########
File path: python/pyarrow/compute.py
##########
@@ -93,20 +119,10 @@ def _decorate_compute_function(wrapper, exposed_name,
func, option_class):
return wrapper
-_option_classes = {
- # TODO: export the option class name from C++ metadata?
- 'cast': CastOptions,
- 'filter': FilterOptions,
- 'index_in': SetLookupOptions,
- 'is_in': SetLookupOptions,
- 'match_substring': MatchSubstringOptions,
- 'min_max': MinMaxOptions,
- 'partition_nth_indices': PartitionNthOptions,
- 'stddev': VarianceOptions,
- 'strptime': StrptimeOptions,
- 'take': TakeOptions,
- 'variance': VarianceOptions,
-}
+def _get_options_class(func):
+ class_name = func._doc.options_class
+ # XXX should we raise if the class isn't exposed in Python?
+ return globals().get(class_name) if class_name else None
Review comment:
I made it emit a warning instead. Raising is not very friendly towards
C++ developers that don't know Python.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]