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

Method Append

python/pyarrow/src/arrow/python/python_to_arrow.cc:840–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838class PyListConverter : public ListConverter<T, PyConverter, PyConverterTrait> {
839 public:
840 Status Append(PyObject* value) override {
841 if (PyValue::IsNull(this->options_, value)) {
842 return this->list_builder_->AppendNull();
843 }
844 if (has_numpy() && PyArray_Check(value)) {
845 RETURN_NOT_OK(AppendNdarray(value));
846 } else if (PySequence_Check(value)) {
847 RETURN_NOT_OK(AppendSequence(value));
848 } else if (PySet_Check(value) || (Py_TYPE(value) == &PyDictValues_Type)) {
849 RETURN_NOT_OK(AppendIterable(value));
850 } else if (PyDict_Check(value) && this->type()->id() == Type::MAP) {
851 // Branch to support Python Dict with `map` DataType.
852 auto items = PyDict_Items(value);
853 OwnedRef item_ref(items);
854 RETURN_NOT_OK(AppendSequence(items));
855 } else {
856 return internal::InvalidType(
857 value, "was not a sequence or recognized null for conversion to list type");
858 }
859
860 return ValidateBuilder(this->list_type_);
861 }
862
863 protected:
864 // MapType does not support args in the Append() method

Callers 15

ConsumeMethod · 0.45
MergeMethod · 0.45
VisitBinaryMethod · 0.45
VisitMethod · 0.45
AppendUTF32Function · 0.45
VisitStringMethod · 0.45
ExtendMethod · 0.45
ExtendMaskedMethod · 0.45
AppendMethod · 0.45
AppendMethod · 0.45
AppendMethod · 0.45

Calls 6

has_numpyFunction · 0.85
InvalidTypeFunction · 0.85
IsNullFunction · 0.50
AppendNullMethod · 0.45
idMethod · 0.45
typeMethod · 0.45

Tested by 1