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 pandas/datetime Timedelta/DateOffset as literals converted to SQL intervals #207

Open
knassre-bodo opened this issue Jan 10, 2025 · 0 comments
Labels
effort - medium mid-sized issue with average implementation time/difficulty enhancement New feature or request extensibility Increasing situations in which PyDough works user feature Adding a new user-facing feature/functionality

Comments

@knassre-bodo
Copy link
Contributor

knassre-bodo commented Jan 10, 2025

The goal of the issue is to add the following support for PyDough literals:

  • Any datetime.timedelta can be passed in, and is threaded throughout the pipeline until SQLGlot conversion where it becomes an equivalent INTERVAL syntax.
  • Same for pandas.Timedelta and pandas.DateOffset with all standard ANSI units: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND (no subsecond, for now, and expand quarters/weeks into months/days).
  • Allow passing in these units as modifier arguments to the DATE function, or just directly adding/subtracting to date/datetime arguments.

Will need to add a new PyDough type for intervals/deltas. The generation of SQLGlot code will need to be quite different for SQLite, which means full type inference is required to realize when the addition/subtraction of such an interval is happening so it can be converted to an equivalent DATE expression, and so using an interval in any other manner is unsupported. This means that type inference support (#194) and the DATE-esque functionality (#208) are required prerequisites.

@knassre-bodo knassre-bodo added enhancement New feature or request user feature Adding a new user-facing feature/functionality effort - medium mid-sized issue with average implementation time/difficulty extensibility Increasing situations in which PyDough works labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort - medium mid-sized issue with average implementation time/difficulty enhancement New feature or request extensibility Increasing situations in which PyDough works user feature Adding a new user-facing feature/functionality
Projects
None yet
Development

No branches or pull requests

1 participant