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

feat(bigquery): Support MAKE_INTERVAL #4384

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

VaggelisD
Copy link
Collaborator

This PR adds support for BQ's MAKE_INTERVAL and enables transpilation towards DuckDB & Snowflake by serializing the units into INTERVAL '<units>' expressions:

bigquery> SELECT CAST('2024-01-01 10:00:00' AS DATETIME) + MAKE_INTERVAL(1, 2, minute => 5, day => 3);
2025-03-04T10:05:00

snowflake> SELECT CAST('2024-01-01 10:00:00' AS TIMESTAMP) + INTERVAL '1 year, 2 month, 5 minute, 3 day';
2025-03-04 10:05:00.000

duckdb> SELECT CAST('2024-01-01 10:00:00' AS TIMESTAMP) + INTERVAL '1 year 2 month 5 minute 3 day';
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (CAST('2024-01-01 10:00:00' AS TIMESTAMP) + CAST('1 year 2 month 5 minute 3 day' AS INTERVAL)) │
│                                           timestamp                                            │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 2025-03-04 10:05:00                                                                            │
└────────────────────────────────────────────────────────────────────────────────────────────────┘

Docs

BQ MAKE_INTERVAL | Snowflake INTERVAL | DuckDB INTERVAL

@georgesittas georgesittas merged commit e7b67e0 into main Nov 13, 2024
6 checks passed
@georgesittas georgesittas deleted the vaggelisd/bq_make_interval branch November 13, 2024 15:27
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

Successfully merging this pull request may close these issues.

2 participants