benbellick opened a new issue, #26605:
URL: https://github.com/apache/datafusion/issues/26605
### Describe the bug
`date_bin` returns NULL when a valid non-null timestamp’s computed bin falls
outside the output timestamp type’s range.
#22215 requested an error instead of a panic. Its fix, #22408, prevented the
panic but returned NULL instead.
### To Reproduce
```sql
SELECT date_bin(
INTERVAL '3 nanoseconds',
arrow_cast(-9223372036854775808, 'Timestamp(Nanosecond, None)'),
TIMESTAMP '1970-01-01 00:00:00'
);
```
Currently returns NULL because the containing bin starts below the minimum
representable nanosecond timestamp.
### Expected behavior
Return an error for an unrepresentable bin, matching [PostgreSQL’s
behavior](https://www.db-fiddle.com/f/h3qSHUSRprbzkX9GBkSuY2/0).
Preserve the scalar/array consistency established by #22528 and #22610.
Equivalent scalar and column inputs should return the same valid bin or both
error. NULL timestamp inputs should remain NULL, and representable bins should
continue to succeed even when intermediate arithmetic requires a wider type.
### Additional context
Related to the audit in #25344. This change does not enable `date_bin`
range-locality analysis.
### Willingness to contribute
I plan to contribute a fix for this bug independently
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]