Skip to content

feat: Support INTERVAL expressions #189

@ajitpratap0

Description

@ajitpratap0

Description

Add support for SQL INTERVAL expressions for date/time arithmetic.

Example SQL

SELECT NOW() - INTERVAL '1 day';
SELECT created_at + INTERVAL '2 hours' FROM events;
SELECT * FROM orders WHERE created_at > NOW() - INTERVAL '30 days';
SELECT INTERVAL '1 year 2 months 3 days';

Current Behavior

INTERVAL expressions may not be fully parsed.

Expected Behavior

Parser should recognize INTERVAL keyword and parse the interval value with unit specifications.

Priority

Medium - commonly used for date/time calculations

Implementation Notes

  • Add TokenTypeInterval token type if not present
  • Create IntervalExpression AST node
  • Support various interval formats: '1 day', '2 hours', compound intervals

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions