| 321 | }; |
| 322 | |
| 323 | Status NumPyConverter::Convert() { |
| 324 | if (PyArray_NDIM(arr_) != 1) { |
| 325 | return Status::Invalid("only handle 1-dimensional arrays"); |
| 326 | } |
| 327 | |
| 328 | if (dtype_->type_num == NPY_OBJECT) { |
| 329 | // If an object array, convert it like a normal Python sequence |
| 330 | PyConversionOptions py_options; |
| 331 | py_options.type = type_; |
| 332 | py_options.from_pandas = from_pandas_; |
| 333 | ARROW_ASSIGN_OR_RAISE( |
| 334 | auto chunked_array, |
| 335 | ConvertPySequence(reinterpret_cast<PyObject*>(arr_), |
| 336 | reinterpret_cast<PyObject*>(mask_), py_options, pool_)); |
| 337 | out_arrays_ = chunked_array->chunks(); |
| 338 | return Status::OK(); |
| 339 | } |
| 340 | |
| 341 | if (type_ == nullptr) { |
| 342 | return Status::Invalid("Must pass data type for non-object arrays"); |
| 343 | } |
| 344 | |
| 345 | // Visit the type to perform conversion |
| 346 | return VisitTypeInline(*type_, this); |
| 347 | } |
| 348 | |
| 349 | namespace { |
| 350 |
no test coverage detected