Skip to content

Commit ab45e83

Browse files
author
Pietro Vertechi
committed
move DataAPI compatibility in main file
1 parent 0c5a47a commit ab45e83

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/StructArrays.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ export replace_storage
1010
include("interface.jl")
1111
include("structarray.jl")
1212
include("utils.jl")
13-
include("refarray.jl")
1413
include("collect.jl")
1514
include("sort.jl")
1615
include("groupjoin.jl")
1716
include("lazy.jl")
1817
include("tables.jl")
1918

19+
# Implement refarray and refvalue to deal with pooled arrays and weakrefstrings effectively
20+
import DataAPI: refarray, refvalue
21+
22+
refarray(s::StructArray) = StructArray(map(refarray, fieldarrays(s)))
23+
24+
function refvalue(s::StructArray{T}, v::Tup) where {T}
25+
createinstance(T, map(refvalue, fieldarrays(s), v)...)
26+
end
27+
2028
# Use Adapt allows for automatic conversion of CPU to GPU StructArrays
2129
import Adapt
2230
Adapt.adapt_structure(to, s::StructArray) = replace_storage(x->Adapt.adapt(to, x), s)

src/refarray.jl

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)