Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to uparse logical plan with timestamp cast to string #11325

Closed
sgrebnov opened this issue Jul 8, 2024 · 0 comments · Fixed by #11326
Closed

Support to uparse logical plan with timestamp cast to string #11325

sgrebnov opened this issue Jul 8, 2024 · 0 comments · Fixed by #11326
Labels
enhancement New feature or request

Comments

@sgrebnov
Copy link
Member

sgrebnov commented Jul 8, 2024

Is your feature request related to a problem or challenge?

Part of #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, such as those involving string literals and function results cast to timestamps, should be able to be converted back into SQL. Currently, they are failing with the error Unsupported DataType: conversion: Timestamp(Nanosecond, None).

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)
  2. Add a test to expr_to_sql_ok

Additional context

Example issue when using DataFusion with federated database : spiceai/spiceai#1625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant