MCPcopy Create free account
hub / github.com/apache/arrow / Convert

Method Convert

python/pyarrow/src/arrow/python/arrow_to_pandas.cc:2487–2510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2485 }
2486
2487 Status Convert(PyObject** out) override {
2488 PyAcquireGIL lock;
2489
2490 PyObject* result = PyList_New(0);
2491 RETURN_IF_PYERROR();
2492
2493 for (int i = 0; i < num_columns_; ++i) {
2494 std::shared_ptr<PandasWriter> writer;
2495 RETURN_NOT_OK(GetWriter(i, &writer));
2496 // ARROW-3789 Use std::move on the array to permit self-destructing
2497 RETURN_NOT_OK(writer->Write(std::move(arrays_[i]), i, /*rel_placement=*/0));
2498
2499 PyObject* item;
2500 RETURN_NOT_OK(writer->GetDataFrameResult(&item));
2501 if (PyList_Append(result, item) < 0) {
2502 RETURN_IF_PYERROR();
2503 }
2504 // PyList_Append increments object refcount
2505 Py_DECREF(item);
2506 }
2507
2508 *out = result;
2509 return Status::OK();
2510 }
2511
2512 private:
2513 std::vector<std::shared_ptr<PandasWriter>> writers_;

Callers 1

ConvertTableToPandasFunction · 0.45

Calls 3

OKFunction · 0.50
WriteMethod · 0.45
GetDataFrameResultMethod · 0.45

Tested by

no test coverage detected