fsspec / fsspec/kerchunk

Dataclass for "VirtualZarrStore"

Open
#375 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
366
Forks
96
Avg merge
24m
Merged PRs (30d)
1

Description

Problem

Kerchunk user code currently passes around an obscure multiply-nested "reference dict" object. This is hard to read, interrogate, validate, or reason about.

Suggestion

Instead create a new VirtualZarrStore dataclass, which contains all the same information that is currently stored in the reference dict but in a more structured manner. This would then be the principle object that gets passed around between user calls to kerchunk API.

Advantages
  • Easier to read and interrogate than multiply-nested dicts
  • Allows direct validation
  • Serializes in obvious ways (via .to_json, to_parquet, .to_dict or similar.)
  • Easier to write tests, by using fixtures to generate VirtualZarrStore objects
  • Concentrates concerns over changes/enhancements to Zarr Spec in one class
  • A v2->v3 converter could act directly on these objects
  • Possibly easier to understand whenever anyone reimplements kerchunk in other languages?
Implementation ideas
  • Implementation could subclass Zarr Object Model classes (where .to_json is analogous to the ZOM's .serialize), which then would be solidified as the recommended abstract representation once ZEP006 is accepted
  • Can't use a bare ZOM class because we need to add some extra attributes for byte ranges etc. However information on where to find chunks is essentially a "Chunk Manifest", a generalizable idea that @jhamman has also been working on (for a nascent ZEP007??)
  • Attributes of this dataclass need to always be serializable, so the VirtualZarrStore should be basically a json schema (see #373)
Questions
  • Is it possible to do this in a broadly backwards-compatible manner?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by reviewing how kerchunk currently passes and serializes its nested reference dictionaries, then read the linked Zarr Object Model and ZEP006 discussions. Define the scope and backwards-compatibility requirements for a VirtualZarrStore before implementation; done would require an agreed structured representation, serialization approach, and migration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.