Document that NaN in a data variable is read as SQL NULL
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
首先检查 xarray_sql/df.py 中的转换以及 ADBC 方言,然后查看 docs/limitations.md 和读取文档,找到最适合添加此说明的位置。说明数据变量中的 NaN 会变成 SQL NULL,聚合函数会跳过它,并且无法将其读取为 NaN 值。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 142
- 派生
- 19
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
xqlsystems/xarray-sql 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 64/100
xqlsystems/xarray-sql#267 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 74/100
xqlsystems/xarray-sql#243 ·
维护者通常 1 天内回复
-
publish.yml: the TestPyPI verification step is unreachable (and installs the wrong package name)未关闭
难度 2/5 1-3 小时 新手友好度 62/100
xqlsystems/xarray-sql#242 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
xqlsystems/xarray-sql#237 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
xqlsystems/xarray-sql#231 ·
维护者通常 1 天内回复
查看 xqlsystems/xarray-sql 的全部 Issue
相似的 Issue
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
drevendev/HungryCrab#273 ·
维护者通常 1 天内回复
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 76/100
drevendev/BeautifulRepo#19 ·
维护者通常 2 天内回复
-
Moonshot: Kimi K3 always sends `reasoning_effort="max"`, though the API now accepts `low` and `high`未关闭accepted
难度 2/5 1-3 小时 新手友好度 78/100
UKGovernmentBEIS/inspect_ai#5939 ·
维护者通常 1 天内回复
-
bug linux
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
area:data data-quality
难度 2/5 1-3 小时 新手友好度 68/100
reacher-z/Awesome-CUA#1468 ·
维护者通常 1 天内回复