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

Oracle trunc function support by ClickHouse dialect #4733

Closed
sleshJdev opened this issue Feb 12, 2025 · 1 comment
Closed

Oracle trunc function support by ClickHouse dialect #4733

sleshJdev opened this issue Feb 12, 2025 · 1 comment
Assignees

Comments

@sleshJdev
Copy link
Contributor

sleshJdev commented Feb 12, 2025

sqlglot==25.28.0:

parse_one("SELECT trunc(current_timestamp) FROM T", dialect='oracle').sql('clickhouse')
"SELECT DATE_TRUNC('DD', CURRENT_TIMESTAMP()) FROM T"

Expected result SELECT DATE_TRUNC('day', CURRENT_TIMESTAMP()) FROM T

Here is the list of units supported by https://clickhouse.com/docs/en/sql-reference/functions/date-time-functions#date_trunc

Oracle's trunc function documentation https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/TRUNC-date.html

@georgesittas
Copy link
Collaborator

We looked into this one, but it's a bit tricky to transpile at the moment because units are not normalized like time formats. I'll close the ticket as out of scope for now, but may revisit when someone in the core team has more bandwidth. We'll also be happy to accept well-tested PRs.

@georgesittas georgesittas closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants