Non-exhaustive type inference
| 791 | |
| 792 | // Non-exhaustive type inference |
| 793 | Result<std::shared_ptr<DataType>> InferArrowType(PyObject* obj, PyObject* mask, |
| 794 | bool pandas_null_sentinels) { |
| 795 | if (pandas_null_sentinels) { |
| 796 | // ARROW-842: If pandas is not installed then null checks will be less |
| 797 | // comprehensive, but that is okay. |
| 798 | internal::InitPandasStaticData(); |
| 799 | } |
| 800 | |
| 801 | std::shared_ptr<DataType> out_type; |
| 802 | TypeInferrer inferrer(pandas_null_sentinels); |
| 803 | RETURN_NOT_OK(inferrer.VisitSequence(obj, mask)); |
| 804 | RETURN_NOT_OK(inferrer.GetType(&out_type)); |
| 805 | if (out_type == nullptr) { |
| 806 | return Status::TypeError("Unable to determine data type"); |
| 807 | } else { |
| 808 | return std::move(out_type); |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | ARROW_PYTHON_EXPORT |
| 813 | bool IsPyBool(PyObject* obj) { return internal::PyBoolScalar_Check(obj); } |
no test coverage detected