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