diff --git a/ibis/backends/datafusion/__init__.py b/ibis/backends/datafusion/__init__.py index 915289864f34..6504f966399a 100644 --- a/ibis/backends/datafusion/__init__.py +++ b/ibis/backends/datafusion/__init__.py @@ -622,10 +622,8 @@ def create_table( if schema is not None: schema = ibis.schema(schema) - properties = [] - if temp: - properties.append(sge.TemporaryProperty()) + raise NotImplementedError("DataFusion does not support temporary tables") quoted = self.compiler.quoted @@ -669,7 +667,6 @@ def create_table( create_stmt = sge.Create( kind="TABLE", this=target, - properties=sge.Properties(expressions=properties), expression=query, replace=overwrite, ) diff --git a/ibis/backends/datafusion/tests/test_register.py b/ibis/backends/datafusion/tests/test_register.py index 16a82973c7fa..f50194c80ab5 100644 --- a/ibis/backends/datafusion/tests/test_register.py +++ b/ibis/backends/datafusion/tests/test_register.py @@ -56,3 +56,12 @@ 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) diff --git a/ibis/backends/tests/test_client.py b/ibis/backends/tests/test_client.py index 2d80b56c4b4a..5411eb2d05cb 100644 --- a/ibis/backends/tests/test_client.py +++ b/ibis/backends/tests/test_client.py @@ -119,7 +119,14 @@ 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"], + [ + "pyspark", + "trino", + "exasol", + "risingwave", + "impala", + "datafusion", + ], reason="No support for temp tables", ), pytest.mark.notyet( @@ -145,7 +152,14 @@ def test_create_table(backend, con, temp_table, func, sch): id="temp, no overwrite", marks=[ pytest.mark.notyet( - ["pyspark", "trino", "exasol", "risingwave", "impala"], + [ + "pyspark", + "trino", + "exasol", + "risingwave", + "impala", + "datafusion", + ], reason="No support for temp tables", ), pytest.mark.notimpl(["mssql"], reason="Incorrect temp table syntax"), @@ -308,6 +322,9 @@ 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( @@ -1562,6 +1579,9 @@ 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, diff --git a/ibis/backends/tests/test_string.py b/ibis/backends/tests/test_string.py index 7f7c545dbed6..f1b74341ee35 100644 --- a/ibis/backends/tests/test_string.py +++ b/ibis/backends/tests/test_string.py @@ -1061,7 +1061,14 @@ def string_temp_table(backend, con): ) temp_table_name = gen_name("strings") - temp = backend.name() not in ["exasol", "impala", "pyspark", "risingwave", "trino"] + temp = backend.name() not in [ + "exasol", + "impala", + "pyspark", + "risingwave", + "trino", + "datafusion", + ] if backend.name() == "druid": yield "I HATE DRUID" else: