jorisvandenbossche commented on code in PR #13109:
URL: https://github.com/apache/arrow/pull/13109#discussion_r875567732
##########
python/pyarrow/compute.py:
##########
@@ -369,10 +371,14 @@ def cast(arr, target_type, safe=True):
"""
if target_type is None:
raise ValueError("Cast target type must not be None")
- if safe:
- options = CastOptions.safe(target_type)
- else:
- options = CastOptions.unsafe(target_type)
+ if (safe is not None) and (options is not None):
+ raise ValueError(
+ "Must past only a value for 'safe' or only a value for 'options'")
+ if options is None:
+ if safe:
Review Comment:
We will need some handling here to interpret `safe=None` as `safe=True` (now
it will be interpreted as False, which explains the test failures)
##########
python/pyarrow/array.pxi:
##########
@@ -905,14 +905,16 @@ cdef class Array(_PandasConvertible):
----------
target_type : DataType
Type to cast array to.
- safe : boolean, default True
+ safe : boolean, default None
Review Comment:
Although we changed it in the signature, I would keep it here as "True",
because that is still the actual default behaviour if you don't specify neither
of the params.
--
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]