sgrebnov opened a new issue, #11325: URL: https://github.com/apache/datafusion/issues/11325
### Is your feature request related to a problem or challenge? Part of https://github.com/apache/datafusion/issues/9494 to enhance support for Unparsing LogicalPlan to SQL String. Converting LogicalPlans back to SQL is valuable for several usecases such as using DataFusion in federated databases (e.g. generate SQL to push down) or using DataFusion's expr APIs to programmatically create SQL. ### Describe the solution you'd like The logical plan derived from queries with time predicates like those below (involving string literals and function result casting to timestamp) should be able to be turned back into SQL. Currently, they are failing with `Unsupported DataType: conversion: Timestamp(Nanosecond, None)`. ```sql select * from taxi_trips where pickup_datetime > now() select * from taxi_trips where pickup_datetime = '2013-08-22 06:24:12-02' ``` ### Describe alternatives you've considered 1. Implement the arrow to ast cast support for timestamp in Unparser::expr_to_sql([source link](https://github.com/apache/datafusion/blob/16346022ed4564211c0fb4bf20ac165f2c481a90/datafusion/sql/src/unparser/expr.rs#L200-L205)) 1. Add a test to [expr_to_sql_ok](https://github.com/apache/datafusion/blob/16346022ed4564211c0fb4bf20ac165f2c481a90/datafusion/sql/src/unparser/expr.rs#L912-L913) ### Additional context Example issue when using DataFusion with federated database : https://github.com/spiceai/spiceai/issues/1625 -- 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]
