baumgold opened a new pull request, #405:
URL: https://github.com/apache/arrow-julia/pull/405

   Currently when there's a table containing a column of type variable-size 
list, whenever the user accesses an entry in the list a new Vector is 
instantiated causing allocations and performance degradation.  This PR proposes 
to prevent instantiating the Vector and instead return to the user a zero-copy 
view of the data (SubArray) that still abides by the AbstractVector interface.
   
   For example, instead of getting a newly-allocated `Vector{Int64}`:
   
   ```julia
   julia> using Arrow, Tables
   
   julia> x = (a=[1,2,3], b=[[1,1,1], [2,2], [3,3,3,3]]);
   
   julia> table = Arrow.Table(Arrow.tobuffer(x))
   Arrow.Table with 3 rows, 2 columns, and schema:
   :a  Int64
   :b  Vector{Int64} (alias for Array{Int64, 1})
   
   julia> p = iterate(Tables.rows(table))
   (Tables.ColumnsRow{Tables.CopiedColumns{Arrow.Table}}: (a = 1, b = [1, 1, 
1]), 2)
   
   julia> p[1].b
   3-element Vector{Int64}:
   1
   1
   1
   ```
   
   we'll instead get a `SubArray`:
   
   ```julia
   julia> using Arrow, Tables
   
   julia> x = (a=[1,2,3], b=[[1,1,1], [2,2], [3,3,3,3]]);
   
   julia> table = Arrow.Table(Arrow.tobuffer(x))
   Arrow.Table with 3 rows, 2 columns, and schema:
   :a  Int64
   :b  Vector{Int64} (alias for Array{Int64, 1})
   
   julia> p = iterate(Tables.rows(table))
   (Tables.ColumnsRow{Tables.CopiedColumns{Arrow.Table}}: (a = 1, b = [1, 1, 
1]), 2)
   
   julia> p[1].b
   3-element view(::Arrow.Primitive{Int64, Vector{Int64}}, 1:3) with eltype 
Int64:
   1
   1
   1
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to