Skip to content
Permalink
Browse files
add missing setmedata! method for Arrow.Table (#170)
  • Loading branch information
jrevels committed Apr 7, 2021
1 parent 000d89f commit 6be335c7386f061f51bd66a598bc35eed5280934
Showing 2 changed files with 8 additions and 1 deletion.
@@ -171,6 +171,7 @@ columns(t::Table) = getfield(t, :columns)
lookup(t::Table) = getfield(t, :lookup)
schema(t::Table) = getfield(t, :schema)
getmetadata(t::Table) = isdefined(getfield(t, :metadata), :x) ? getfield(t, :metadata)[] : nothing
setmetadata!(t::Table, m::Dict{String, String}) = (setindex!(getfield(t, :metadata), m); nothing)

Tables.istable(::Table) = true
Tables.columnaccess(::Table) = true
@@ -245,7 +246,7 @@ function Table(bytes::Vector{UInt8}, off::Integer=1, tlen::Union{Integer, Nothin
else
A = ChainedVector([dictencoding.data, values])
S = field.dictionary.indexType === nothing ? Int32 : juliaeltype(field, field.dictionary.indexType, false)
dictencodings[id] = DictEncoding{eltype(A), S, typeof(A)}(id, A, field.dictionary.isOrdered, values.metadata)
dictencodings[id] = DictEncoding{eltype(A), S, typeof(A)}(id, A, field.dictionary.isOrdered, values.metadata)
end
continue
end
@@ -276,6 +276,12 @@ ArrowTypes.JuliaType(::Val{:CustomStruct2}, S, meta) = CustomStruct2{Symbol(meta
tbl = Arrow.Table(Arrow.tobuffer(t))
@test eltype(tbl.col1) == CustomStruct2{:hey}

# 170
tbl = Arrow.Table(Arrow.tobuffer((x = [1,2,3],)))
m = Dict("a" => "b")
Arrow.setmetadata!(tbl, m)
@test Arrow.getmetadata(tbl) === m

end # @testset "misc"

end

0 comments on commit 6be335c

Please sign in to comment.