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
- 9
環境準備
- 沒有 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
-
comp/cli P3 type/security
難度 2/5 1-3 小時 新手友好度 68/100
NousResearch/hermes-agent#141420 · 1 則留言 ·
維護者通常 1 天內回覆
-
vendor-pitch
難度 2/5 1-3 小時 新手友好度 87/100
維護者通常 1 天內回覆
-
bug llm p2
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
New tool: ZIPZAX Python Notebook Studio可能已有人在做 @github-actions 今天認領。 未關閉submission triage
難度 1/5 1 小時以內 新手友好度 68/100
kausalflow/tools#226 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100