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

Method Convert

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

Source from the content-addressed store, hash-verified

2516 }
2517
2518 Status Convert(PyObject** out) override {
2519 PyAcquireGIL lock;
2520
2521 PyObject* result = PyList_New(0);
2522 RETURN_IF_PYERROR();
2523
2524 for (int i = 0; i < num_columns_; ++i) {
2525 std::shared_ptr<PandasWriter> writer;
2526 RETURN_NOT_OK(GetWriter(i, &writer));
2527 // ARROW-3789 Use std::move on the array to permit self-destructing
2528 RETURN_NOT_OK(writer->Write(std::move(arrays_[i]), i, /*rel_placement=*/0));
2529
2530 PyObject* item;
2531 RETURN_NOT_OK(writer->GetDataFrameResult(&item));
2532 if (PyList_Append(result, item) < 0) {
2533 RETURN_IF_PYERROR();
2534 }
2535 // PyList_Append increments object refcount
2536 Py_DECREF(item);
2537 }
2538
2539 *out = result;
2540 return Status::OK();
2541 }
2542
2543 private:
2544 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