Skip to content

Feature Request: Support minsize=0 #65

Description

@ojwoodford

I have a situation where I kick off N tasks, and the nth task processes the nth chunk of several different collections. In some collections, the nth chunk might not exist, because the collection is shorter than n. Currently I have to write a wrapper function to avoid throwing an error in this case, as follows:

function ithchunk(N, taskid, collection)
    c = index_chunks(collection; n=N)
    return view(collection, taskid <= length(c) ? c[taskid] : 1:0)
end

However, if ChunkSplitters supported a minsize=0, such that N chunks were always returned, some of them being empty, then I could simply write:

ithchunk(N, taskid, collection) = chunks(collection; n=N, minsize=0)[taskid]

and be certain that this wouldn't throw an error for any taskid <= N. This could avoid any potential type instability resulting from the ternary operator in my wrapper function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions