readPoint() reads only part.0.parquet, so points written from a partitioned dask frame lose rows
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
Línea de trabajo
Empieza en R/read.R, en la ruta de readPoint() que abre points.parquet/part.0.parquet; compara el caso de pandas con un único archivo con el de varias partes Parquet de un frame dask particionado en Python. Lee todas las partes y comprueba cómo se establece source_path, ya que path() en R/path.R lo devuelve. Se considera terminado cuando el ejemplo reproducido de cuatro partes devuelve los 5,000,000 puntos y path() informa de una ruta de origen útil.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- R
- Estrellas
- 37
- Forks
- 10
- Merge medio
- 22 h 46 min
- PR fusionados (30 d)
- 20
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de HelenaLC/spatialdataR
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
HelenaLC/spatialdataR#252 ·
Los mantenedores suelen responder en 1 día
-
axes order in image/label show methodPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
HelenaLC/spatialdataR#239 · 11 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 60/100
HelenaLC/spatialdataR#271 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
HelenaLC/spatialdataR#251 · 6 comentarios · 3 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
HelenaLC/spatialdataR#241 ·
Los mantenedores suelen responder en 1 día
Todos los issues de HelenaLC/spatialdataR
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PecanProject/pecan#4183 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
philchalmers/mirt#287 ·
-
querySqlToAndromeda(appendToTable = TRUE) errors with "This ResultSet is closed" after appendingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
OHDSI/DatabaseConnector#346 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100