-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
What happens?
The count() query results of Duckdb SQL are inconsistent with those of Polars SQL and DataFrame API interfaces.
To Reproduce
import polars as pl
import duckdb
ctx = pl.SQLContext()
t0 = pl.LazyFrame(
{
"c0": [1, 1]
}
)
ctx.register("t0", t0)
print("Polars SQL result: ")
polars_sql_result = ctx.execute("SELECT COUNT(1) FROM t0", eager=False)
print(polars_sql_result.collect())
print("Polars API result: ")
polars_api_result = t0.select(pl.lit(1).count())
print(polars_api_result.collect())
con = duckdb.connect()
con.execute(f"""
CREATE TABLE t0 AS SELECT * FROM VALUES (1), (1) AS t0(c0);
""")
t0 = con.table("t0")
print("Duckdb SQL result: ")
duckdb_result = con.sql("SELECT COUNT(1) FROM t0").pl()
print(duckdb_result)
con.close()Polars SQL result:
shape: (1, 1)
┌─────────┐
│ literal │
│ --- │
│ u32 │
╞═════════╡
│ 1 │
└─────────┘
Polars API result:
shape: (1, 1)
┌─────────┐
│ literal │
│ --- │
│ u32 │
╞═════════╡
│ 1 │
└─────────┘
Duckdb SQL result:
shape: (1, 1)
┌──────────┐
│ count(1) │
│ --- │
│ i64 │
╞══════════╡
│ 2 │
└──────────┘OS:
x86_64 Ubuntu 24.04 Linux-6.14.0-35-generic-x86_64-with-glibc2.39
DuckDB Version:
1.4.2
DuckDB Client:
Python
Hardware:
No response
Full Name:
asddfl
Affiliation:
xxx
Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?
- Yes, I have
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant data sets for reproducing the issue?
Yes