In-memory tables: an in-place write that moves a NaN reads wrongly (the validity bitmap is computed at registration)
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start by reading the from_dataset docstring and the in-memory table registration path described in the issue, then compare how registration builds the validity bitmap with how shared values change after an in-place write. Reproduce the two NaN-to-number and number-to-NaN cases, including with Context.prepare. Done means the behavior or its documented limitation is consistent and both cases are covered.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🌀 Claude (xarray-sql)
Summary
A small in-memory Dataset is registered as a native in-memory table that shares its data variables' memory (#275). from_dataset's docstring says that, as with a lazy table, "changing the Dataset's values in place changes what queries return". That holds for numbers, but not for NaN. xarray-sql reads a NaN as SQL NULL, and the in-memory table works out which values are NULL once, when it is registered, as a validity bitmap beside the shared values. After an in-place write:
- a NaN written where there was a number reads as NaN, not NULL;
- a number written where there was a NaN reads as NULL.
A lazy table, or the same Dataset registered again, reads the new values as expected.
Reproduction
On #275's branch (in-memory-tables), DataFusion 55.0.0:
import numpy as np
import xarray as xr
import xarray_sql as xql
x = np.array([1.0, np.nan, 3.0])
ctx = xql.Context()
ctx.from_dataset("t", xr.Dataset({"x": ("i", x)}, coords={"i": np.arange(3)}))
query = "SELECT i, x, x IS NULL AS null FROM t ORDER BY i"
print(ctx.sql(query).to_pydict())
# {'i': [0, 1, 2], 'x': [1.0, None, 3.0], 'null': [False, True, False]}
x[0] = np.nan
x[1] = 2.0
print(ctx.sql(query).to_pydict())
# {'i': [0, 1, 2], 'x': [nan, None, 3.0], 'null': [False, True, False]}
again = xql.Context()
again.from_dataset("t", xr.Dataset({"x": ("i", x)}, coords={"i": np.arange(3)}))
print(again.sql(query).to_pydict())
# {'i': [0, 1, 2], 'x': [None, 2.0, 3.0], 'null': [True, False, False]}
Options
- Say so in the docstring: an in-place write must keep its NaNs where they were, or the Dataset must be registered again.
- Keep NaN as a value in in-memory tables, with no bitmap (#251 asks for that mode in general). That would differ from lazy tables until #251 lands for both.
The same limit applies to Context.prepare, which runs a planned query again on values written in place. It checks that a write keeps its NaNs where they were.
- Ngôn ngữ chính
- Python
- Star
- 142
- Fork
- 19
- Merge trung bình
- 3 ngày 47 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của xqlsystems/xarray-sql
-
dependencies github_actions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
xqlsystems/xarray-sql#295 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
A big-endian data variable registers, then every query fails: Byte-swapped arrays not supportedĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
xqlsystems/xarray-sql#288 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
documentation ml
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
xqlsystems/xarray-sql#268 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement ml
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
xqlsystems/xarray-sql#267 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
xqlsystems/xarray-sql#243 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của xqlsystems/xarray-sql
Issue tương tự
-
documentation good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MarketSquare/robotframework-browser#5479 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
endoflife-date/endoflife.date#11561 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
OCA/l10n-brazil#5602 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation review-2.0.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dkuenzel/meshcore-home-gateway#106 ·
Maintainer thường phản hồi trong vòng 1 ngày