Skip to content

Fix ConcatDiskArray size with zero-length parts - #347

Open
Beforerr wants to merge 1 commit into
JuliaIO:mainfrom
Beforerr:fix-concat-zero-length
Open

Beforerr wants to merge 1 commit into
JuliaIO:mainfrom
Beforerr:fix-concat-zero-length

Conversation

@Beforerr

Copy link
Copy Markdown
Contributor

Problem

ConcatDiskArray counts each zero-length part as length 1:

using DiskArrays, DiskArrays.TestTypes
a = AccessCountDiskArray(collect(1:2); chunksize=(2,))
e = AccessCountDiskArray(Int[]; chunksize=(2,))
size(cat(e, a, e; dims=1))  # (4,), expected (2,)

Reads are then shifted (d[2:3] returns the wrong elements) and writes fail.

Root cause

arraysize_and_startinds uses 0 to mean "no size seen yet for this grid slot" and then runs replace!(sizeall, 0 => 1) to fill slots that only hold unsized MissingTiles. A real zero length can't be told apart from "unset", so it becomes 1. For the same reason, a zero-size part never conflicts with a differently sized part in the same row or column, so the "Array sizes don't form a grid" check doesn't fire.

Fix

Use -1 to mean "unset". Unsized MissingTile slots still default to length 1.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant