Skip to content

Commit

Permalink
test(datafusion): replace register with create_table or read
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler White <[email protected]>
  • Loading branch information
IndexSeek authored and jcrist committed Sep 13, 2024
1 parent 56b8ce4 commit 1e5e2a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
11 changes: 4 additions & 7 deletions ibis/backends/datafusion/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ def _load_data(self, **_: Any) -> None:
con = self.connection
for table_name in TEST_TABLES:
path = self.data_dir / "parquet" / f"{table_name}.parquet"
with pytest.warns(FutureWarning, match="v9.1"):
con.register(path, table_name=table_name)
# TODO: remove warnings and replace register when implementing 8858
with pytest.warns(FutureWarning, match="v9.1"):
con.register(array_types, table_name="array_types")
con.register(win, table_name="win")
con.register(topk, table_name="topk")
con.read_parquet(path, table_name=table_name)
con.create_table("array_types", array_types)
con.create_table("win", win)
con.create_table("topk", topk)

@staticmethod
def connect(*, tmpdir, worker_id, **kw):
Expand Down
13 changes: 5 additions & 8 deletions ibis/backends/datafusion/tests/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ def test_read_parquet(conn, data_dir):

def test_register_table(conn):
tab = pa.table({"x": [1, 2, 3]})
with pytest.warns(FutureWarning, match="v9.1"):
conn.register(tab, "my_table")
conn.create_table("my_table", tab)
assert conn.table("my_table").x.sum().execute() == 6


def test_register_pandas(conn):
df = pd.DataFrame({"x": [1, 2, 3]})
with pytest.warns(FutureWarning, match="v9.1"):
conn.register(df, "my_table")
assert conn.table("my_table").x.sum().execute() == 6
conn.create_table("my_table", df)
assert conn.table("my_table").x.sum().execute() == 6


def test_register_batches(conn):
batch = pa.record_batch([pa.array([1, 2, 3])], names=["x"])
with pytest.warns(FutureWarning, match="v9.1"):
conn.register(batch, "my_table")
assert conn.table("my_table").x.sum().execute() == 6
conn.create_table("my_table", batch)
assert conn.table("my_table").x.sum().execute() == 6


def test_register_dataset(conn):
Expand Down

0 comments on commit 1e5e2a2

Please sign in to comment.