| 1067 | class RListConverter : public ListConverter<T, RConverter, RConverterTrait> { |
| 1068 | public: |
| 1069 | Status Extend(SEXP x, int64_t size, int64_t offset = 0) override { |
| 1070 | RETURN_NOT_OK(this->Reserve(size)); |
| 1071 | |
| 1072 | RVectorType rtype = GetVectorType(x); |
| 1073 | if (rtype != LIST) { |
| 1074 | return Status::Invalid("Cannot convert to list type"); |
| 1075 | } |
| 1076 | |
| 1077 | auto append_null = [this]() { return this->list_builder_->AppendNull(); }; |
| 1078 | |
| 1079 | auto append_value = [this](SEXP value) { |
| 1080 | // TODO: if we decide that this can be run concurrently |
| 1081 | // we'll have to do vec_size() upfront |
| 1082 | R_xlen_t n = arrow::r::vec_size(value); |
| 1083 | |
| 1084 | RETURN_NOT_OK(this->list_builder_->ValidateOverflow(n)); |
| 1085 | RETURN_NOT_OK(this->list_builder_->Append()); |
| 1086 | return this->value_converter_.get()->Extend(value, n); |
| 1087 | }; |
| 1088 | |
| 1089 | return VisitVector(RVectorIterator<SEXP>(x, offset), size, append_null, append_value); |
| 1090 | } |
| 1091 | |
| 1092 | void DelayedExtend(SEXP values, int64_t size, RTasks& tasks) override { |
| 1093 | // NOTE: because Extend::[]append_value() calls Extend() on the |
no test coverage detected