Decimal data type corruption #21096
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Log output
Issue description
When querying MySQL tables with DECIMAL data types, subsequent operations on those fields cause data corruption. In this example, when attempting to get the last non NULL value of column 'x' by unique groups of columns 'a' and 'b', the column with DECIMAL dtype is multplied by a factor of 10k
Expected behavior
shape: (6, 3)
┌─────┬─────┬──────┐
│ a ┆ b ┆ x │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ f64 │
╞═════╪═════╪══════╡
│ 1 ┆ 1 ┆ 2.4 │
│ 1 ┆ 1 ┆ 6.7 │
│ 1 ┆ 1 ┆ null │
│ 2 ┆ 2 ┆ 5.0 │
│ 2 ┆ 2 ┆ 2.3 │
│ 2 ┆ 3 ┆ 5.5 │
└─────┴─────┴──────┘
shape: (6, 3)
┌─────┬─────┬─────┐
│ a ┆ b ┆ x │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ f64 │
╞═════╪═════╪═════╡
│ 1 ┆ 1 ┆ 6.7 │
│ 1 ┆ 1 ┆ 6.7 │
│ 1 ┆ 1 ┆ 6.7 │
│ 2 ┆ 2 ┆ 2.3 │
│ 2 ┆ 2 ┆ 2.3 │
│ 2 ┆ 3 ┆ 5.5 │
└─────┴─────┴─────┘
shape: (6, 3)
┌─────┬─────┬───────────────┐
│ a ┆ b ┆ x │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ decimal[15,4] │
╞═════╪═════╪═══════════════╡
│ 1 ┆ 1 ┆ 67000.0000 │
│ 1 ┆ 1 ┆ 67000.0000 │
│ 1 ┆ 1 ┆ 67000.0000 │
│ 2 ┆ 2 ┆ 23000.0000 │
│ 2 ┆ 2 ┆ 23000.0000 │
│ 2 ┆ 3 ┆ 55000.0000 │
└─────┴─────┴───────────────┘
Installed versions
The text was updated successfully, but these errors were encountered: