Skip to content

Commit 9e457ac

Browse files
committed
Remove needless virtual specifiers
1 parent 3b1db7d commit 9e457ac

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

cpp/src/arrow/sparse_tensor.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)