Blosc / Blosc/python-blosc2

ZSTD compresion with dictionary causes odd errors

Offen
#208 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
211
Forks
58
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
6

Beschreibung

When activating the "use_dict" flag in an SChunk instance, storing data leads to errors.

The following code does not execute on my system:

```
import blosc2
import numpy as np

CHUNKSIZE = int(2**12)
NCHUNKS = 5

coptions = blosc2.cparams_dflts.copy()
coptions["codec"] = blosc2.Codec.ZSTD # this is already the default
coptions["use_dict"] = 1

_rng = np.random.default_rng()

def _make_data() -> bytes:
return _rng.random(CHUNKSIZE // 4, dtype=np.float32).tobytes()

data = [_make_data() for x in range(NCHUNKS)]

storage = blosc2.SChunk(
chunksize=CHUNKSIZE, cparams=coptions, dparams=blosc2.dparams_dflts
)

for x in data:
storage.append_data(x)

for index, x in enumerate(data):
assert storage.decompress_chunk(index) == x
```

Instead, it leads to the following `RuntimeError`:

```
Traceback (most recent call last):
File "/home/user/minimal_bug.py", line 26, in
storage.append_data(x)
File "/home/user/env/lib/python3.9/site-packages/blosc2/schunk.py", line 298, in append_data
return super(SChunk, self).append_data(data)
File "blosc2_ext.pyx", line 1105, in blosc2.blosc2_ext.SChunk.append_data
RuntimeError: Could not append the buffer
```

If the above code is run with `coptions["use_dict"] = 0`, it executes successfully.

Do specific flags need to be set for shared dictionary compression to be successful, or does the sizing of stored data have different requirements?

python-blosc2 version: `blosc2==2.3.2`
python version: `3.9.18`
platform: arch linux, conda based python install

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere das bereitgestellte minimale Skript mit python-blosc2 2.3.2 und untersuche SChunk.append_data in schunk.py zusammen mit dem Traceback-Pfad in blosc2_ext.pyx. Ermittle, warum use_dict=1 diese Chunks ablehnt, und verifiziere anschließend, dass das Anhängen aller fünf Buffer und das Dekomprimieren jedes einzelnen mit aktiviertem Dictionary erfolgreich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
28/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.