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

add bigframes.bigquery.timestamp_add and other BigQuery timestamp SQL functions #719

Open
tswast opened this issue May 22, 2024 · 0 comments
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tswast
Copy link
Collaborator

tswast commented May 22, 2024

Is your feature request related to a problem? Please describe.

It's not currently possible to directly add datetime.timedelta objects to timestamp Series because we don't currently have a data type to represent these in BigQuery DataFrames (bigframes) yet.

Describe the solution you'd like

I would like to workaround these limitations by using the SQL methods directly. Please expose methods such as https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_add to the bigframes.bigquery namespace.

Describe alternatives you've considered

  1. We've had discussions about how to represent pandas timedeltas in bigframes by using INT64 columns in BigQuery with local metadata to say these are actually timedelta and should be treated as microseconds.
  2. The BigQuery INTERVAL type closely maps to https://arrow.apache.org/docs/python/generated/pyarrow.month_day_nano_interval.html and that's what we get from the BQ Storage Read API. It would be helpful to make this type act more like DateOffset objects in pandas https://pandas.pydata.org/pandas-docs/version/1.1/user_guide/timeseries.html#dateoffset-objects and in bigframes itself.

Additional context

See: https://stackoverflow.com/q/78480391/101923

@tswast tswast added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label May 22, 2024
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. label May 22, 2024
@junyazhang junyazhang assigned tswast and unassigned junyazhang Sep 6, 2024
@tswast tswast assigned sycai and unassigned tswast Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants