0x26res opened a new issue, #15109:
URL: https://github.com/apache/arrow/issues/15109

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   I want to create a StructArray with several rows but no fields/columns:
   
   ```
       array = pa.StructArray.from_arrays(arrays=[], names=[], 
mask=pa.array([True, True]))
       assert array.type == pa.struct([])
       assert len(array) == 0 # This is wrong
   ```
   
   As commented in the code `len(array)` is wrong and should be 2 (according to 
the provided mask).
   
   I found a work around but it's not ideal:
   
   ```
       array = pa.StructArray.from_arrays(
           arrays=[pa.nulls(2, pa.null())], names=["DELETE"], 
mask=pa.array([True, True])
       )
       assert len(array) == 2
       empty_array = array.cast(pa.struct([]))
       assert len(empty_array) == 2
       assert empty_array.type == pa.struct([])
   ```
   
   
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to