Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Document that NaN in a data variable is read as SQL NULL

Abierto Apto para principiantes
#268 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Documentación
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Empieza por revisar la conversión en xarray_sql/df.py y los dialectos ADBC; después, consulta docs/limitations.md y la documentación sobre lectura para encontrar el mejor lugar para esta nota. Documenta que NaN en una variable de datos se convierte en SQL NULL, que las funciones de agregación lo omiten y que no hay forma de leerlo como un valor NaN.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

documentation

xarray-sql turns NaN in a data variable into SQL NULL when it scans a Dataset (pa.array(..., from_pandas=True) in xarray_sql/df.py, and the same in the ADBC dialects). That is deliberate, so aggregates skip missing values the way xarray's skipna does. I couldn't find it in the user docs, though, and it surprised me.

What I expected

That a float NaN stays NaN, as it does in a Parquet file or an Arrow table registered directly, and that SUM over a column with a NaN returns NaN.

What happens

import numpy as np, xarray as xr, xarray_sql as xql

ds = xr.Dataset({"x": (("t",), [1.0, np.nan, 2.0])}, coords={"t": [0, 1, 2]})
ctx = xql.Context()
ctx.from_dataset("v", ds)
ctx.sql("SELECT SUM(x) AS s, COUNT(x) AS n, COUNT(*) AS rows FROM v").to_pandas()
# s = 3.0, n = 2, rows = 3

isnan(x) on that row is NULL, not true, and DuckDB through xql.register behaves the same.

Where it mattered

A check that attention masks pairs out rather than weighting them by zero put a NaN in V and expected it to reach only the queries allowed to see it. Every output stayed finite, because the NaN had become a NULL that SUM skipped. The check uses +inf instead, which xarray-sql keeps as a value.

Suggestion

Document it, for example in docs/limitations.md or the reading docs: NaN in a data variable is read as NULL; aggregates skip it; there's no way to read a NaN as a value. Whether to offer an option to keep NaN is a separate question.

Lenguaje dominante
Python
Estrellas
142
Forks
19
Merge medio
1 d 9 h
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de xqlsystems/xarray-sql

Todos los issues de xqlsystems/xarray-sql

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.