diff --git a/src/broadcast.jl b/src/broadcast.jl index 2ae0c29..9c790b5 100644 --- a/src/broadcast.jl +++ b/src/broadcast.jl @@ -62,15 +62,20 @@ function common_chunks(s, args...) all(ar -> isa(eachchunk(ar), GridChunks), chunkedarrays) || error("Currently only chunks of type GridChunks can be merged by broadcast") if isempty(chunkedarrays) - totalsize = sum(sizeof ∘ eltype, args) - return estimate_chunksize(s, totalsize) + # Estimate chunk size for isbits + if all(map(isbits ∘ eltype, args)) + totalsize = sum(sizeof ∘ eltype, args) + return estimate_chunksize(s, totalsize) + else # Otherwise just use one huge chunk, we dont know what the object is + return GridChunks(s, s) + end elseif length(chunkedarrays) == 1 return eachchunk(only(chunkedarrays)) else allchunks = collect(map(eachchunk, chunkedarrays)) tt = ntuple(N) do n csnow = filter(allchunks) do cs - ndims(cs) >= n && first(first(cs.chunks[n])) < last(last(cs.chunks[n])) + ndims(cs) >= n && first(first(cs.chunks[n])) < last(last(cs.chunks[n])) end isempty(csnow) && return RegularChunks(1, 0, s[n]) diff --git a/test/runtests.jl b/test/runtests.jl index eaa3b49..c3045a8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1116,3 +1116,8 @@ end @inferred DiskArrays.DiskIndex(a_view5, (1:1, 1:1, 1:1, 1:1, 1:1), DiskArrays.NoBatch()) #DiskArrays.DiskIndex @inferred DiskArrays.DiskIndex(a_view6, (1:1, 1:1, 1:1, 1:1, 1:1, 1:1), DiskArrays.NoBatch()) #DiskArrays.DiskIndex end + +@testset "test broadcast over strings" begin + a = UnchunkedDiskArray(["a", "b", "c"]) + @test all(a .== ["a", "b", "c"]) +end