baumgold commented on code in PR #397:
URL: https://github.com/apache/arrow-julia/pull/397#discussion_r1134720104


##########
src/arraytypes/arraytypes.jl:
##########
@@ -35,14 +35,19 @@ function toarrowvector(x, i=1, de=Dict{Int64, Any}(), 
ded=DictEncoding[], meta=g
     @debugv 2 "converting top-level column to arrow format: col = 
$(typeof(x)), compression = $compression, kw = $(kw.data)"

Review Comment:
   This function should probably be broken down into a few smaller functions 
for clarity:
   
   ```julia
   
   toarrowvector(a::ArrowVector, compression::Nothing, kw...) = a
   
   function toarrowvector(a::ArrowVector, 
compression::AbstractVector{LZ4FrameCompressor}, kw...)
       lock(LZ4_FRAME_COMPRESSOR_LOCK[Threads.threadid()]) do
           compress(Meta.CompressionTypes.LZ4_FRAME, compression[tid], a)
       end
   end
   
   function toarrowvector(a::ArrowVector, compression::LZ4FrameCompressor, 
Vector{ZstdCompressor}, ZstdCompressor}=nothing, kw...)
       compress(Meta.CompressionTypes.LZ4_FRAME, compression, a)
   end
   
   function toarrowvector(a::ArrowVector, 
compression::AbstractVector{ZstdCompressor}, kw...)
       compress(Meta.CompressionTypes.ZSTD, compression, a)
   end
   
   function toarrowvector(a::ArrowVector, compression::ZstdCompressor, kw...)
       lock(ZSTD_COMPRESSOR_LOCK[Threads.threadid()]) do
           compress(Meta.CompressionTypes.ZSTD, compression[tid], a)
       end
   end
   
   function toarrowvector(x, i=1, de=Dict{Int64, Any}(), ded=DictEncoding[], 
meta=getmetadata(x); compression::Union{Nothing, Vector{LZ4FrameCompressor}, 
LZ4FrameCompressor, Vector{ZstdCompressor}, ZstdCompressor}=nothing, kw...)
       @debugv 2 "converting top-level column to arrow format: col = 
$(typeof(x)), compression = $compression, kw = $(kw.data)"
       @debugv 3 x
       A = arrowvector(x, i, 0, 0, de, ded, meta; compression=compression, 
kw...)
       A = toarrowvector(A, compression)
       @debugv 2 "converted top-level column to arrow format: $(typeof(A))"
       @debugv 3 A
       return A
   end
   
   
   ```



-- 
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