Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying empty Polars dataframe produces internal error #11946

Closed
2 tasks done
davidjbrennan opened this issue May 6, 2024 · 0 comments · Fixed by #11982
Closed
2 tasks done

Querying empty Polars dataframe produces internal error #11946

davidjbrennan opened this issue May 6, 2024 · 0 comments · Fixed by #11982

Comments

@davidjbrennan
Copy link

davidjbrennan commented May 6, 2024

What happens?

When querying an empty Polars dataframe, an INTERNAL Error: Failed to bind "arrow_scan" is produced. A following query against a populated Polars dataframe produces a FATAL Error: Failed: database has been invalidated because of a previous fatal error. The database must be restarted prior to being used again.

To Reproduce

python
Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import polars as pl
import duckdb

polars_empty_df = pl.DataFrame()
polars_df = pl.DataFrame({"a":[1,2,3]})

duckdb.sql("from polars_empty_df")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/davidbrennan/venv/lib/python3.12/site-packages/duckdb/__init__.py", line 455, in sql
    return conn.sql(query, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
duckdb.duckdb.InternalException: INTERNAL Error: Failed to bind "arrow_scan": Table function must return at least one column
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/dev/internal_errors

A following query against a populated Polars dataframe produces the following:

duckdb.sql("from polars_df")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
duckdb.duckdb.InvalidInputException: Invalid Input Error: Attempting to execute an unsuccessful or closed pending query result
Error: FATAL Error: Failed: database has been invalidated because of a previous fatal error. The database must be restarted prior to being used again.
Original error: "Failed to bind "arrow_scan": Table function must return at least one column"

OS:

MacOS Sonama 14.4.1 (silicon)

DuckDB Version:

0.10.3-dev777

DuckDB Client:

Python 3.12.3

Full Name:

David Brennan

Affiliation:

None

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants