You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "neilconway (via GitHub)" <gi...@apache.org> on 2026/10/01 16:23:45 UTC
[I] `decimal % 1` returns 0 for non-nullable decimal columns [datafusion]
neilconway opened a new issue, #25946:
URL: https://github.com/apache/datafusion/issues/25946
### Describe the bug
For a decimal column declared `NOT NULL`, `col % 1` returns 0 for every row: `1.50 % 1` returns `0.00`. The same expression on a nullable decimal column returns the correct `0.50`. Filters on the expression are wrong as well.
### To Reproduce
```sql
CREATE TABLE t (d DECIMAL(10,2) NOT NULL, n DECIMAL(10,2)) AS VALUES (1.50, 1.50);
SELECT d % 1 AS not_null_col, n % 1 AS nullable_col FROM t;
-- not_null_col: 0.00 (wrong), nullable_col: 0.50
SELECT count(*) AS cnt FROM t WHERE d % 1 = 0;
-- 1 (expected 0)
SELECT d % CAST(1 AS DECIMAL(10,2)) AS dec_literal FROM t;
-- 0.00 (wrong)
```
### Expected behavior
`d % 1` returns `0.50`, matching the nullable column, and the `WHERE` query returns 0.
### Additional context
Reproduced on `main` at commit 2b1fcae86, in both release and debug builds.
*This bug report was generated by Claude.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] `decimal % 1` returns 0 for non-nullable decimal columns [datafusion]
Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 closed issue #25946: `decimal % 1` returns 0 for non-nullable decimal columns
URL: https://github.com/apache/datafusion/issues/25946
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org