File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class ARROW_EXPORT SparseTensorBase {
112112 public:
113113 virtual ~SparseTensorBase () = default ;
114114
115- virtual SparseTensorFormat::type sparse_tensor_format_id () const = 0;
115+ SparseTensorFormat::type sparse_tensor_format_id () const { return sparse_index_-> format_id (); }
116116
117117 std::shared_ptr<DataType> type () const { return type_; }
118118 std::shared_ptr<Buffer> data () const { return data_; }
@@ -135,7 +135,7 @@ class ARROW_EXPORT SparseTensorBase {
135135 bool is_mutable () const { return data_->is_mutable (); }
136136
137137 // / Total number of non-zero cells in the sparse tensor
138- virtual int64_t length () const = 0;
138+ int64_t length () const { return sparse_index_ ? sparse_index_-> length () : 0 ; }
139139
140140 bool Equals (const SparseTensorBase& other) const ;
141141
@@ -181,13 +181,6 @@ class ARROW_EXPORT SparseTensor : public SparseTensorBase {
181181 // Constructor with a dense tensor
182182 explicit SparseTensor (const Tensor& tensor);
183183
184- SparseTensorFormat::type sparse_tensor_format_id () const {
185- return SparseIndexType::format_id;
186- }
187-
188- // / Total number of non-zero cells in the sparse tensor
189- int64_t length () const { return sparse_index_ ? sparse_index_->length () : 0 ; }
190-
191184 private:
192185 ARROW_DISALLOW_COPY_AND_ASSIGN (SparseTensor);
193186};
You can’t perform that action at this time.
0 commit comments