You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "DHRUV6029 (via GitHub)" <gi...@apache.org> on 2026/10/05 03:04:39 UTC
Re: [PR] fix: unwrap_cast_in_comparison drops the timezone shift when unwrapping CAST(timestamp AS timestamptz) = literal [datafusion]
DHRUV6029 commented on PR #25099:
URL: https://github.com/apache/datafusion/pull/25099#issuecomment-5987374411
Hi @Ruchirtripathi, thanks for working on this!
I picked up #25941, and while digging into it I realized it's the same bug as #25095, just triggered a bit differently. It uses a fixed-offset time zone like `+05:00` or `-03:00` instead of a named zone like `Asia/Singapore`. For example:
```sql
CREATE TABLE t AS VALUES (TIMESTAMP '2024-01-01 10:00:00');
SELECT count(*) FROM t
WHERE arrow_cast(column1, 'Timestamp(Nanosecond, Some("+05:00"))')
= arrow_cast('2024-01-01T10:00:00+05:00', 'Timestamp(Nanosecond, Some("+05:00"))');
-- returns 0 on main, should be 1
```
The root cause is the same: the unwrap_cast rewrite copies the literal's value without applying the timezone shift.
I applied your change on top of current main (`6e319bddd`) and ran all the queries from #25941. They return the right results now.
Since this PR fixes both issues, could you add `Closes #25941` to the description? That way both get closed when it merges.
Thanks!
--
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