Calculating the mean of a Decimal column returns nulls #15953
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
┌─────┬───────────────┐
│ c ┆ mean │
│ --- ┆ --- │
│ str ┆ decimal[38,0] │
╞═════╪═══════════════╡
│ foo ┆ null │
│ bar ┆ null │
└─────┴───────────────┘
Log output
Issue description
My data source is a Denodo view where one of the fields is of the Decimal (19,4) type. I read this into Polars (v. 0.20.23) using read_database(). And sure enough it's read as that data type (despite that fact that I haven't activated Decimals in the config and that none of the values that my query returns are even close to going beyond the limits of Float64, but I guess the Denodo view's dtype specification is respected).
I want to group by another column and do a calculation of the Decimal-column's mean. But this returns only nulls.
I am not sure if this is partially or fully expected with the Decimal type since it's considered "unstable".
For the actual "real world" example where I ran into this issue, I can get around it by converting the column to Float64, but that obviously wouldn't work if I had rows with values that would overflow that dtype.
Expected behavior
Actual means of the groups, not missing values.
Installed versions
The text was updated successfully, but these errors were encountered: