You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @asddfl, DuckDB and Polars indeed behave differently when an expression with only constants is given as argument to COUNT. Sorry for the verbosity, but some examples:
DuckDB counts all rows for which the expression evaluates to something other than NULL. Polars does this as well, but only if the expression involves a column name... Otherwise it returns 1, regardless of the amount of rows. I personally feel that DuckDB's behavior is more consistent here, wdyt? Does this somehow cause issues for you? If so, can you share more context?
Activity
paultiq commentedon Nov 14, 2025
In Polars,
select count(constant)returns 1:evertlammerts commentedon Nov 14, 2025
Hey @asddfl, DuckDB and Polars indeed behave differently when an expression with only constants is given as argument to
COUNT. Sorry for the verbosity, but some examples:DuckDB counts all rows for which the expression evaluates to something other than NULL. Polars does this as well, but only if the expression involves a column name... Otherwise it returns 1, regardless of the amount of rows. I personally feel that DuckDB's behavior is more consistent here, wdyt? Does this somehow cause issues for you? If so, can you share more context?