\brief Create a SparseTensor with full parameters
| 561 | |
| 562 | /// \brief Create a SparseTensor with full parameters |
| 563 | static inline Result<std::shared_ptr<SparseTensorImpl<SparseIndexType>>> Make( |
| 564 | const std::shared_ptr<SparseIndexType>& sparse_index, |
| 565 | const std::shared_ptr<DataType>& type, const std::shared_ptr<Buffer>& data, |
| 566 | const std::vector<int64_t>& shape, const std::vector<std::string>& dim_names) { |
| 567 | if (!is_tensor_supported(type->id())) { |
| 568 | return Status::Invalid(type->ToString(), |
| 569 | " is not valid data type for a sparse tensor"); |
| 570 | } |
| 571 | ARROW_RETURN_NOT_OK(sparse_index->ValidateShape(shape)); |
| 572 | if (dim_names.size() > 0 && dim_names.size() != shape.size()) { |
| 573 | return Status::Invalid("dim_names length is inconsistent with shape"); |
| 574 | } |
| 575 | return std::make_shared<SparseTensorImpl<SparseIndexType>>(sparse_index, type, data, |
| 576 | shape, dim_names); |
| 577 | } |
| 578 | |
| 579 | /// \brief Create a sparse tensor from a dense tensor |
| 580 | /// |
nothing calls this directly
no test coverage detected