readPoint() reads only part.0.parquet, so points written from a partitioned dask frame lose rows
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia in R/read.R, nel percorso di readPoint() che apre points.parquet/part.0.parquet; confronta il caso di un singolo file con pandas con quello di più parti Parquet di un frame dask partizionato in Python. Leggi tutte le parti e verifica come viene impostato source_path, dato che path() in R/path.R lo restituisce. Il lavoro è concluso quando l’esempio riprodotto con quattro parti restituisce tutti i 5,000,000 punti e path() riporta un percorso sorgente utile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
While testing spicyR's SpatialData writer against stores written by Python, we found that readPoint() can silently return only part of a points element. It happens whenever Python wrote the points from a dask frame with more than one partition, which Python stores as several parquet files. readPoint() reads only the first. The fix looks like a one-line change to read all the parts, and we've checked that it returns every point in the example below.
What happens. readPoint() opens points.parquet/part.0.parquet only (R/read.R#L80). Python's spatialdata writes one parquet file per dask partition. A points element built from a dask frame with several partitions is therefore stored as part.0.parquet … part.k.parquet, and readPoint() returns the rows of the first part only, with no warning. (Points built from a pandas frame are a single partition and aren't affected, however large they are.)
To reproduce (spatialdata 0.7.3, spatialdataR devel at db1f01a):
import numpy as np, pandas as pd, dask.dataframe as dd, spatialdata as sd
from spatialdata.models import PointsModel
rng = np.random.default_rng(1)
df = pd.DataFrame({"x": rng.random(5_000_000), "y": rng.random(5_000_000)})
pts = PointsModel.parse(dd.from_pandas(df, npartitions=4))
sd.SpatialData(points={"pts": pts}).write("parts.zarr")
# parts.zarr/points/pts/points.parquet/ holds part.0.parquet ... part.3.parquet
spatialdataR::readPoint("parts.zarr/points/pts")
#> class: SpatialDataPoint
#> count: 1250000
The element has 5,000,000 points.
Suggested fix. Read every part. ddbs_open_dataset() accepts a glob, and with this change the example above returns all 5,000,000 points:
pq <- file.path(x, "points.parquet", "*.parquet")
One knock-on effect: path() returns attr(df, "source_path") (R/path.R#L41), so it would then return the glob. Setting source_path to the points.parquet folder instead might be clearer for users.
This is the bug we mentioned in #115. Let us know if you'd like the PR, or whether you'd rather fix it alongside other work on the readers.
- Lingua principale
- R
- Stelle
- 37
- Fork
- 10
- Merge medio
- 22h 46m
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HelenaLC/spatialdataR
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
HelenaLC/spatialdataR#252 ·
I maintainer di solito rispondono entro 1 giorno
-
axes order in image/label show methodForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
HelenaLC/spatialdataR#239 · 11 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 60/100
HelenaLC/spatialdataR#271 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
HelenaLC/spatialdataR#251 · 6 commenti · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
HelenaLC/spatialdataR#241 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HelenaLC/spatialdataR
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
philchalmers/mirt#287 ·
-
querySqlToAndromeda(appendToTable = TRUE) errors with "This ResultSet is closed" after appendingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OHDSI/DatabaseConnector#346 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100