[ 
https://issues.apache.org/jira/browse/ARROW-17933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17655748#comment-17655748
 ] 

Bruce Martin commented on ARROW-17933:
--------------------------------------

It is still early days, so I don't have a well-rounded perspective.  Would be 
happy to share more as we get further along.

Our community primarily uses the R and Python bindings, doing data-sciency 
stuff.  So far, the top-of-mind items are:

1.  zero-copy conversion between SparseCOOTensor and a COO-representation of 
the same data in a 3-column Table -- if that is even a sensible ask (I don't 
know the internal memory layout well enough to know).  We have use cases that 
move back and forth, and I believe it currently requires a copy, at least for 
coordinates.

2. Better R ecosystem integration - specifically to/from various R 
tensor/matrix (eg., `Matrix`)


> SparseCOOTensor raises error when created with zero elements
> ------------------------------------------------------------
>
>                 Key: ARROW-17933
>                 URL: https://issues.apache.org/jira/browse/ARROW-17933
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 9.0.0
>         Environment: Ubuntu 22, Python 3.10, Pyarrow 9.0.0
>            Reporter: Bruce Martin
>            Assignee: Rok Mihevc
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Using pyarrow, SparseCOOTensor generates an error when created with zero 
> elements. SparseCSCMatrix and SparseCSRMatrix work fine.
> Example:
> {code:java}
> In [24]: pyarrow._version_
> Out[24]: '9.0.0'
> In [25]: 
> pyarrow.SparseCSCMatrix.from_scipy(scipy.sparse.csc_matrix(numpy.zeros((2,4)),
>  dtype=numpy.float32)).non_zero_length
> Out[25]: 0
> In [26]: 
> pyarrow.SparseCSRMatrix.from_scipy(scipy.sparse.csr_matrix(numpy.zeros((2,4)),
>  dtype=numpy.float32)).non_zero_length
> Out[26]: 0
> In [27]: 
> pyarrow.SparseCOOTensor.from_scipy(scipy.sparse.coo_matrix(numpy.zeros((2,4)),
>  dtype=numpy.float32)).non_zero_length
> ---------------------------------------------------------------------------
> ArrowInvalid Traceback (most recent call last)
> Cell In [27], line 1
> ----> 1 
> pyarrow.SparseCOOTensor.from_scipy(scipy.sparse.coo_matrix(numpy.zeros((2,4)),
>  dtype=numpy.float32)).non_zero_length
> File ~/venv/lib/python3.10/site-packages/pyarrow/tensor.pxi:400, in 
> pyarrow.lib.SparseCOOTensor.from_scipy()
> File ~/venv/lib/python3.10/site-packages/pyarrow/error.pxi:100, in 
> pyarrow.lib.check_status()
> ArrowInvalid: SparseCOOIndex indices must be contiguous
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to