A view keeps reading a table after it is replaced: DataFusion binds views at creation
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading the Context table registration and deregistration behavior and the benchmark demo in benchmarks/ml referenced in the report. The issue offers documentation, a warning or refusal, or an upstream DataFusion report as possible directions, so first determine which outcome the maintainers want. Done means the chosen behavior is handled and the stale-view example no longer surprises users.
索引モデルが issue の本文から書いたものです。
説明
On a Context, a view keeps reading the table it was created over, even after a new Dataset is registered under the same name. It returns the old rows without an error.
import numpy as np
import xarray as xr
import xarray_sql as xql
ctx = xql.Context()
ctx.from_dataset("t", xr.Dataset({"x": ("i", np.array([1.0]))}, coords={"i": [0]}))
ctx.sql("CREATE VIEW v AS SELECT x FROM t")
ctx.deregister_table("t")
ctx.from_dataset("t", xr.Dataset({"x": ("i", np.array([2.0]))}, coords={"i": [0]}))
print("table:", ctx.sql("SELECT x FROM t").to_pydict()) # {'x': [2.0]}
print("view: ", ctx.sql("SELECT x FROM v").to_pydict()) # {'x': [1.0]}: the old table
DataFusion 54.0.0, xarray-sql main. The same happens on a plain DataFusion SessionContext with register_record_batches, so the behavior is DataFusion's: CREATE VIEW stores a logical plan whose table scans hold the table providers that existed when the view was created.
Why it's a surprise:
- DuckDB (1.5.5) resolves a view's tables by name when the view is queried, so the same steps, with
xql.register, return the new rows. - PostgreSQL also binds a view to its tables when the view is created, but it refuses to drop a table that a view depends on unless you
DROP … CASCADE. So it never returns stale rows. - DataFusion binds early and also allows the drop, so the view silently reads data that is no longer registered.
Where it bites: any loop that replaces a Dataset under a fixed name and reads it through a view. Examples are a training loop that re-registers its parameters each step, or a pipeline that swaps in each day's data. I hit it while writing the GPT demo in benchmarks/ml (#269) as a model view plus a loss. The demo works around it by recreating the view after each re-registration.
Possible directions:
- Document it in the limitations page.
- Have
Contextwarn, or refuse, whenderegister_tableorfrom_datasetreplaces a table that a view reads. - Report it upstream to DataFusion, if late binding or a dependency check would be welcome there. I didn't find an existing issue in apache/datafusion.
🌀 Claude (ML demos, xarray-sql)
- 主要言語
- Python
- スター
- 142
- フォーク
- 19
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
xqlsystems/xarray-sql のほかの issue
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
xqlsystems/xarray-sql#268 ·
メンテナーはふだん 1 日以内に返信
-
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 日以内に返信
xqlsystems/xarray-sql の issue をすべて見る
似ている issue
-
idxmax/idxmin raise ValueError when a single partition is all-NA対応中かも @Jason10191019999 が今日担当しました。 オープンneeds triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
[BUG]: Windows GUI package of v1.17.0-rc3 has no GTK DLLs対応中かも @andrut-ds が今日担当しました。 オープンbug CI/CD Pactus-GUI Windows
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
pactus-project/pactus#2428 ·
メンテナーはふだん 1 日以内に返信
-
DiskDataset.reshard() can hang with a zero or negative shard size対応中かも @Programmer-Develops が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 19 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
GNS3/gns3-server#3017 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信