Skip to content

Commit

Permalink
revert: fix(datafusion): raise when attempting to create temp table (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored Sep 11, 2024
1 parent bac76ff commit d48a575
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 40 deletions.
5 changes: 4 additions & 1 deletion ibis/backends/datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,10 @@ def create_table(
if schema is not None:
schema = ibis.schema(schema)

properties = []

if temp:
raise NotImplementedError("DataFusion does not support temporary tables")
properties.append(sge.TemporaryProperty())

quoted = self.compiler.quoted

Expand Down Expand Up @@ -657,6 +659,7 @@ def create_table(
create_stmt = sge.Create(
kind="TABLE",
this=target,
properties=sge.Properties(expressions=properties),
expression=query,
replace=overwrite,
)
Expand Down
9 changes: 0 additions & 9 deletions ibis/backends/datafusion/tests/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,3 @@ def test_create_table_with_uppercase_name(conn):
tab = pa.table({"x": [1, 2, 3]})
conn.create_table("MY_TABLE", tab)
assert conn.table("MY_TABLE").x.sum().execute() == 6


def test_raise_create_temp_table(conn):
tab = pa.table({"x": [1, 2, 3]})
with pytest.raises(
NotImplementedError,
match="DataFusion does not support temporary tables",
):
conn.create_table("my_temp_table", tab, temp=True)
24 changes: 2 additions & 22 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,7 @@ def test_create_table(backend, con, temp_table, func, sch):
marks=[
pytest.mark.notyet(["clickhouse"], reason="Can't specify both"),
pytest.mark.notyet(
[
"pyspark",
"trino",
"exasol",
"risingwave",
"impala",
"datafusion",
],
["pyspark", "trino", "exasol", "risingwave", "impala"],
reason="No support for temp tables",
),
pytest.mark.notyet(
Expand All @@ -152,14 +145,7 @@ def test_create_table(backend, con, temp_table, func, sch):
id="temp, no overwrite",
marks=[
pytest.mark.notyet(
[
"pyspark",
"trino",
"exasol",
"risingwave",
"impala",
"datafusion",
],
["pyspark", "trino", "exasol", "risingwave", "impala"],
reason="No support for temp tables",
),
pytest.mark.notimpl(["mssql"], reason="Incorrect temp table syntax"),
Expand Down Expand Up @@ -322,9 +308,6 @@ def test_create_table_from_schema(con, new_schema, temp_table):
raises=com.IbisError,
reason="`tbl_properties` is required when creating table with schema",
)
@pytest.mark.notimpl(
["datafusion"], raises=NotImplementedError, reason="no temp table support"
)
def test_create_temporary_table_from_schema(con_no_data, new_schema):
if con_no_data.name == "snowflake" and os.environ.get("SNOWFLAKE_SNOWPARK"):
with pytest.raises(
Expand Down Expand Up @@ -1579,9 +1562,6 @@ def test_json_to_pyarrow(con):
assert result == expected


@pytest.mark.notimpl(
["datafusion"], raises=NotImplementedError, reason="no temp table support"
)
@pytest.mark.notyet(
["risingwave", "exasol"],
raises=com.UnsupportedOperationError,
Expand Down
9 changes: 1 addition & 8 deletions ibis/backends/tests/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,14 +1059,7 @@ def string_temp_table(backend, con):
)

temp_table_name = gen_name("strings")
temp = backend.name() not in [
"exasol",
"impala",
"pyspark",
"risingwave",
"trino",
"datafusion",
]
temp = backend.name() not in ["exasol", "impala", "pyspark", "risingwave", "trino"]
if backend.name() == "druid":
yield "I HATE DRUID"
else:
Expand Down

0 comments on commit d48a575

Please sign in to comment.