[Python] pa.DictionaryArray.from_arrays(..) can't convert large numpy / ndarrays
- Lingua principale
- C++
- Stelle
- 17.1k
- Fork
- 4.3k
- Merge medio
- 3g 18h
- PR unite (30g)
- 91
Descrizione
### Describe the bug, including details regarding any error messages, version, and platform.
Numpy arrays seem to get converted with pyarrow.array(..) either to pyarrow.Array OR pyarrow.ChunkedArray depending on its' size according to the documentation.
The pa.DictionaryArray.from_arrays(..) is also specified, that it can treat ndarrays, but in case the ndarray is a large object, there is an internal exception which is not able to treat the ChunkedArray object.
```
import pyarrow as pa
import numpy as np
# 300 MB binary blobs × 10 = 3 GB of total data
blob = b'x' * (300 * 1024 * 1024)
data = [blob] * 10
a = (np.array(data))
# test conversion to pyarrow array
print(type(pa.array(a))) # -> pyarrow.lib.ChunkedArray
indices = np.array(list(range(10)))
# this throws an error, even if a is a legit numpy array
pa.DictionaryArray.from_arrays(indices, a)
'''
------- RESULT ----------
Traceback (most recent call last):
File "", line 1, in
File "pyarrow\\array.pxi", line 4091, in pyarrow.lib.DictionaryArray.from_arrays
TypeError: Cannot convert pyarrow.lib.ChunkedArray to pyarrow.lib.Array
'''
``
### Component(s)
Python
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Iniziate con il reproducer riportato usando pa.array(a) e DictionaryArray.from_arrays(indices, a), verificando che un ndarray NumPy di grandi dimensioni diventi un ChunkedArray. Tracciate i punti di ingresso dei binding Python per queste due API e determinate come dovrebbe essere gestito il caso ChunkedArray; il lavoro è completato quando i grandi ndarrays non generano più il TypeError segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- numpy, python
- Ambito
- data
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100