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(presto,oracle): add support for INTERVAL span types #2035

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

georgesittas
Copy link
Collaborator

Fixes #2027

Comment on lines +3862 to +3872
# https://www.oracletutorial.com/oracle-basics/oracle-interval/
# https://trino.io/docs/current/language/types.html#interval-year-to-month
class IntervalYearToMonthSpan(Expression):
arg_types = {}


# https://www.oracletutorial.com/oracle-basics/oracle-interval/
# https://trino.io/docs/current/language/types.html#interval-day-to-second
class IntervalDayToSecondSpan(Expression):
arg_types = {}

Copy link
Collaborator Author

@georgesittas georgesittas Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI the motivation behind creating these expressions was that it will make our lives easier if / when we decide to support Oracle's full syntax for these interval types. The following are also valid in Oracle, for example:

INTERVAL '120-3' YEAR(3) TO MONTH
INTERVAL '11 10:09:08.555' DAY TO SECOND(3)

sqlglot/parser.py Outdated Show resolved Hide resolved
@tobymao tobymao merged commit 593153c into main Aug 11, 2023
@tobymao tobymao deleted the jo/interval_span branch August 11, 2023 16:11
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.

parsing trino interval day to second and interval year to month into a type doesn't work
2 participants