universalmind303 opened a new issue, #9143: URL: https://github.com/apache/arrow-datafusion/issues/9143
### Describe the bug originally opened in https://github.com/GlareDB/glaredb/issues/2597 It seems that `arrow_cast`'s special handling makes it so that it errors out when using it in an ORDER BY expr ### To Reproduce ```sql statement ok create table ts (a int); statement ok insert into ts values (915148800); # this errors statement ok SELECT DATE_TRUNC('minute', arrow_cast(a, 'Timestamp(Second, None)')) AS minute FROM ts ORDER BY DATE_TRUNC('minute', arrow_cast(a, 'Timestamp(Second, None)')); ``` ### Expected behavior It should be functionally equivalent in this example to using `to_timestamp_seconds` ```sql SELECT DATE_TRUNC('minute', to_timestamp_seconds(a)) AS minute FROM ts ORDER BY DATE_TRUNC('minute', to_timestamp_seconds(a)); ``` ### Additional context _No response_ -- 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]
