HyukjinKwon commented on code in PR #48626:
URL: https://github.com/apache/arrow/pull/48626#discussion_r2647323874
##########
python/pyarrow/src/arrow/python/inference.cc:
##########
@@ -309,6 +337,25 @@ class NumPyDtypeUnifier {
int current_type_num() const { return current_type_num_; }
private:
+ static const char* DatetimeUnitName(NPY_DATETIMEUNIT unit) {
+ switch (unit) {
+ case NPY_FR_s:
+ return "s";
+ case NPY_FR_ms:
+ return "ms";
+ case NPY_FR_us:
+ return "us";
+ case NPY_FR_ns:
+ return "ns";
+ case NPY_FR_D:
+ return "D";
+ case NPY_FR_GENERIC:
+ return "generic";
+ default:
+ return "unknown";
Review Comment:
I think it makes sense. Here is the example that makes sense:
```python
import pyarrow as pa
import numpy as np
# `ps` unsupported but `s` supported.
pa.array([np.datetime64('2020', 'ps'), np.datetime64('2020', 's')])
```
Before:
```
pyarrow.lib.ArrowNotImplementedError: Unsupported datetime64 time unit
```
After:
```
pyarrow.lib.ArrowInvalid: Cannot mix NumPy datetime64 units ps and s
```
--
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]