Ensure ToList converts string-like things to strings
diff --git a/src/arraytypes/list.jl b/src/arraytypes/list.jl
index 0e1c13f..59ce24d 100644
--- a/src/arraytypes/list.jl
+++ b/src/arraytypes/list.jl
@@ -72,7 +72,7 @@
stringtype = ArrowTypes.isstringtype(ST)
T = stringtype ? UInt8 : eltype(ST)
len = stringtype ? ncodeunits : length
- data = AT[]
+ data = stringtype ? (AT !== ST ? Union{Missing, String}[] : String[]) : AT[]
I = largelists ? Int64 : Int32
inds = I[0]
sizehint!(data, length(input))
@@ -82,6 +82,9 @@
if x === missing
push!(data, missing)
else
+ if stringtype
+ x = convert(String, x)
+ end
push!(data, x)
totalsize += len(x)
if I === Int32 && totalsize > 2147483647
@@ -91,7 +94,7 @@
end
push!(inds, totalsize)
end
- return ToList{T, stringtype, AT, I}(data, inds)
+ return ToList{T, stringtype, eltype(data), I}(data, inds)
end
Base.IndexStyle(::Type{<:ToList}) = Base.IndexLinear()
@@ -183,7 +186,7 @@
else
data = arrowvector(flat, de, nothing; lareglists=largelists, kw...)
end
- return List{eltype(x), eltype(flat.inds), typeof(data)}(UInt8[], validity, offsets, data, len, meta)
+ return List{eltype(flat.data), eltype(flat.inds), typeof(data)}(UInt8[], validity, offsets, data, len, meta)
end
function compress(Z::Meta.CompressionType, comp, x::List{T, O, A}) where {T, O, A}