Skip to content

A prepared query of datafusion.<schema>.<table> misses that table's replacement #325

Closed

Description

@alxmrs

🌀 Claude: A prepared query of datafusion.<schema>.<table> doesn't notice that table being replaced. It returns the old rows and doesn't raise.

xarray-sql counts replacements under a name without DataFusion's default catalog and schema. It strips datafusion.public. and public., but not datafusion. in front of another schema. So a query that names datafusion.era5.i is tracked under that whole name, while replacing era5.i is counted under era5.i:

import numpy as np, xarray as xr
from xarray_sql import Context

ds = xr.Dataset(
    {"v": ("i", np.arange(3.0)), "t": (("i", "j"), np.ones((3, 2)))},
    coords={"i": np.arange(3), "j": np.arange(2)},
)  # two groups of dims, so from_dataset makes tables era5.i and era5.i_j
ctx = Context(); ctx.from_dataset("era5", ds)
q = ctx.prepare("SELECT v FROM datafusion.era5.i ORDER BY i")
ctx.sql("CREATE OR REPLACE TABLE era5.i AS SELECT 7.0 AS v, 0 AS i")
ctx.sql("SELECT v FROM datafusion.era5.i")  # [7.0]
q()["v"]                                    # [0.0, 1.0, 2.0], with no error

I reproduced this on main at 447791a (0.7.1), with DataFusion 55.0.0. For the same reason, such a query can't write era5.i. The review of #323 found it, and #323 will fix it.

Activity

  1. added a commit that references this issue on Nov 18, 2026
    bc7a33e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions