diff --git a/src/broadcast.jl b/src/broadcast.jl index 2ae0c29..c50362f 100644 --- a/src/broadcast.jl +++ b/src/broadcast.jl @@ -62,15 +62,19 @@ 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)) + return estimate_chunksize(s) + 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 ef0aee1..4ab3aff 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1146,6 +1146,12 @@ end @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 + @testset "mockchunks" begin a =UnchunkedDiskArray(rand(10,10)) chunks = DiskArrays.RegularChunks.((5,5), (0,0), (10,10))