MCPcopy Create free account
hub / github.com/apache/arrow / GetSparseCSFIndexMetadata

Function GetSparseCSFIndexMetadata

cpp/src/arrow/ipc/metadata_internal.cc:1517–1542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1515}
1516
1517Status GetSparseCSFIndexMetadata(const flatbuf::SparseTensorIndexCSF* sparse_index,
1518 std::vector<int64_t>* axis_order,
1519 std::vector<int64_t>* indices_size,
1520 std::shared_ptr<DataType>* indptr_type,
1521 std::shared_ptr<DataType>* indices_type) {
1522 RETURN_NOT_OK(IntFromFlatbuffer(sparse_index->indptrType(), indptr_type));
1523 RETURN_NOT_OK(IntFromFlatbuffer(sparse_index->indicesType(), indices_type));
1524
1525 auto* fb_axis_order = sparse_index->axisOrder();
1526 auto* fb_indices_buffers = sparse_index->indicesBuffers();
1527 // ValidateSparseCSFIndexMetadata already checks this, keep this check defensively.
1528 if (fb_axis_order == nullptr || fb_indices_buffers == nullptr ||
1529 fb_axis_order->size() != fb_indices_buffers->size()) {
1530 return Status::Invalid(
1531 "Inconsistent CSF sparse index: axisOrder and indicesBuffers have different "
1532 "lengths");
1533 }
1534
1535 const int ndim = static_cast<int>(fb_axis_order->size());
1536 for (int i = 0; i < ndim; ++i) {
1537 axis_order->push_back(fb_axis_order->Get(i));
1538 indices_size->push_back(fb_indices_buffers->Get(i)->length());
1539 }
1540
1541 return Status::OK();
1542}
1543
1544Status GetSparseTensorMetadata(const Buffer& metadata, std::shared_ptr<DataType>* type,
1545 std::vector<int64_t>* shape,

Callers 2

ReadSparseCSFIndexFunction · 0.85
ReadSparseTensorPayloadFunction · 0.85

Calls 7

IntFromFlatbufferFunction · 0.85
push_backMethod · 0.80
InvalidFunction · 0.50
OKFunction · 0.50
sizeMethod · 0.45
GetMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected