tadeja commented on PR #48267: URL: https://github.com/apache/arrow/pull/48267#issuecomment-3589522904
Thank you for the input, @zanmato1984, that helped. > I'm not sure what you mean. The underlying C++ APIs will accept those options. So I would expect no problem for their python bindings. Are you saying that they are not working? It looks like Python bindings got fixed by adding [option class names to FunctionDoc in vector_swizzle.cc](https://github.com/apache/arrow/pull/48267/commits/47e3e8cf8004843764b6f9fe9386ea5a1d5bbc5f#diff-82f49131a414c3c37f943cdc4b3735a875c31b420b3c5e256de63defe9773b4eL335). Now `test_option_class_equality` is failing by default with ```pyarrow.lib.ArrowInvalid: Could not serialize field output_type of options type InversePermutationOptions: shared_ptr<DataType> is nullptr``` unless I pass `output_type` there, e.g. [pc.InversePermutationOptions(output_type=pa.int32())](https://github.com/apache/arrow/pull/48267/commits/47e3e8cf8004843764b6f9fe9386ea5a1d5bbc5f#diff-2010b86c11cb90f0ce6ef00648df2e388d11cda5d3fc74e4293dd862e228daecR205). If `output_type` is NULLPTR in C++ (which happens if `output_type` is `None` in Python) then `InversePermutationOptions` can't be serialized. Any advice on the approach for fixing this? (Should Python users always specify `output_type`, or perhaps `output_type` be optional in C++? Or is it fine to leave it as it is?) See example below: ```python import pyarrow.compute as pc pc.InversePermutationOptions() >>> InversePermutationOptions(max_index=-1, output_type=<NULLPTR>) ``` ```python import pyarrow.compute as pc pc.InversePermutationOptions().serialize() >>> Traceback (most recent call last): File "<python-input-3>", line 1, in <module> pc.InversePermutationOptions().serialize() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "pyarrow/_compute.pyx", line 623, in pyarrow._compute.FunctionOptions.serialize shared_ptr[CBuffer] c_buf = GetResultValue(res) File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status return check_status(status) File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status raise convert_status(status) pyarrow.lib.ArrowInvalid: Could not serialize field output_type of options type InversePermutationOptions: shared_ptr<DataType> is nullptr ``` cc @pitrou -- 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]
