Skip to content

Commit

Permalink
Ensure requested List type is requested on List getindex (#182)
Browse files Browse the repository at this point in the history
* Ensure requested List type is requested on List getindex

Fixes #167. Not tested yet.

* add test
  • Loading branch information
quinnj committed Apr 23, 2021
1 parent 742ea4c commit 8fca1e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ArrowTypes/src/ArrowTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ _symbol(ptr, len) = ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int), ptr, len
fromarrow(::Type{Symbol}, ptr::Ptr{UInt8}, len::Int) = _symbol(ptr, len)

ArrowKind(::Type{<:AbstractArray}) = ListKind()
fromarrow(::Type{A}, x::AbstractVector{T}) where {A <: AbstractVector{T}} where {T} = x
fromarrow(::Type{A}, x::A) where {A <: AbstractVector{T}} where {T} = x
fromarrow(::Type{A}, x::AbstractVector{T}) where {A <: AbstractVector{T}} where {T} = convert(A, x)
ArrowKind(::Type{<:AbstractSet}) = ListKind()
ArrowType(::Type{T}) where {T <: AbstractSet{S}} where {S} = Vector{S}
toarrow(x::AbstractSet) = collect(x)
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ msg = "reached nested serialization level (42) deeper than provided max depth ar
@test_throws ErrorException(msg) Arrow.tobuffer(tbl; maxdepth=41).x
@test Arrow.Table(Arrow.tobuffer(tbl; maxdepth=42)).x == tbl.x

# 167
t = (
col1=[["boop", "she"], ["boop", "she"], ["boo"]],
)
tbl = Arrow.Table(Arrow.tobuffer(t))
@test eltype(tbl.col1) == Vector{String}

end # @testset "misc"

end

0 comments on commit 8fca1e0

Please sign in to comment.