Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add date functions to bigframes.bigquery module#17514

Merged
tswast merged 10 commits into
maingoogleapis/google-cloud-python:mainfrom
tswast-bbqgoogleapis/google-cloud-python:tswast-bbqCopy head branch name to clipboard
Jun 23, 2026
Merged

feat: add date functions to bigframes.bigquery module#17514
tswast merged 10 commits into
maingoogleapis/google-cloud-python:mainfrom
tswast-bbqgoogleapis/google-cloud-python:tswast-bbqCopy head branch name to clipboard

Conversation

@tswast

@tswast tswast commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Used the following prompt:

Update the descriptions and argument names in scripts/data/sql-functions/global-namespace/date.yaml according to the following SQL documentation:

(Paste from https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/date_functions)

Also, if there is a natural argument to use for series_accessor_arg in this yaml or others, add it.

Towards BigQuery SQL API coverage. 🦕

Used the following prompt:

> Update the descriptions and argument names in scripts/data/sql-functions/global-namespace/date.yaml according to the following SQL documentation:
>
> (Paste from https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/date_functions)
>
> Also, if there is a natural argument to use for `series_accessor_arg` in this yaml or others, add it.
@tswast tswast requested review from a team as code owners June 18, 2026 21:07
@tswast tswast requested review from mpovoa and removed request for a team June 18, 2026 21:07
"timestamp": "dtypes.TIMESTAMP_DTYPE",
"decimal<38,9>": "dtypes.NUMERIC_DTYPE",
"decimal<76,38>": "dtypes.BIGNUMERIC_DTYPE",
"interval_day": "dtypes.TIMEDELTA_DTYPE",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not strictly true, but OK for now?

@tswast tswast Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sycai any thoughts on this? Maybe I remove the signatures requiring interval for now?

@shuoweil shuoweil Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this interval_day is only day based operations (DATE_ADD, DATE_SUB), I suggest we rename this variable to num_days for clarity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Disagree. INTERVAL is a BigQuery data type. We don't fully support it yet though.

@shuoweil shuoweil Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. I did not find it https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/date_functions. If we want to fully support INTERVAL, could we do interval_time and interval_unit? In this case, we can support interval with unit of day/hour/min (https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/interval_functions).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sycai any thoughts on this? Maybe I remove the signatures requiring interval for now?

We don't support INTERVAL types, so it SGTM to remove the signatures requiring intervals.

On the other hand, we may consider keeping the functions whose signatures have optional INTERVAL parameters -- we would just leave these parameters out in the BF implementations for now.

As for

If we want to fully support INTERVAL, could we do interval_time and interval_unit?

That would complicate our function body, as INTERVAL arithmetics are pretty complicated (see https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/data-types#interval_type). We should probably hold off providing any INTERVAL-equivalent implementations and wait until INTERVAL is formally implemented in our package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed INTERVAL functions and signatures in fc25645

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for BigQuery date operations in BigFrames, including the generation of date functions, series accessors, and corresponding unit tests. The reviewer identified several issues in the date.yaml configuration file where timestamp signatures were incorrectly added to functions that only support DATE or DATETIME expressions in BigQuery (such as DATE_ADD, DATE_BUCKET, DATE_DIFF, DATE_SUB, DATE_TRUNC, FORMAT_DATE, and LAST_DAY). Additionally, the reviewer noted that the EXTRACT function signatures omitting the required part argument are incorrect and should be removed to prevent runtime SQL compilation errors.

Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
Comment thread packages/bigframes/scripts/data/sql-functions/global_namespace/date.yaml Outdated
@tswast tswast requested review from a team and shuoweil and removed request for a team and mpovoa June 23, 2026 17:54
Comment thread packages/bigframes/bigframes/bigquery/__init__.py Outdated
Comment thread packages/bigframes/bigframes/bigquery/__init__.py Outdated
Comment thread packages/bigframes/bigframes/bigquery/__init__.py Outdated
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
@tswast tswast merged commit e5d2e35 into main Jun 23, 2026
32 checks passed
@tswast tswast deleted the tswast-bbq branch June 23, 2026 21:32
shuoweil pushed a commit that referenced this pull request Jun 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.44.0](bigframes-v2.43.0...bigframes-v2.44.0)
(2026-06-25)


### Features

* add date functions to `bigframes.bigquery` module
([#17514](#17514))
([e5d2e35](e5d2e35))
* **bigframes:** add AI TVFs to the pandas bq accessor
([#17402](#17402))
([ee74e31](ee74e31))
* Experimental transpilation of unannotated python callables
([#17419](#17419))
([ea9aad9](ea9aad9))
* support gemini-3.x models in loader and update default model to
gemini-3.5-flash
([#17557](#17557))
([3619b29](3619b29))
* support interactive execution of deferred DataFrames in TableWidget
([#17486](#17486))
([421eebd](421eebd))


### Bug Fixes

* avoid invalid CAST(NULL AS NULL) in SQLGlot compiler
([#17487](#17487))
([3b79caa](3b79caa))
* **bigframes:** world-readable temp zip in create_cloud_function
([#17522](#17522))
([e726878](e726878))
* bump @angular/common, @angular/forms, @angular/platform-browser and
@angular/router in
/packages/bigframes/bigframes/display/table_widget_angular
([#17525](#17525))
([2f893b1](2f893b1))
* bump langsmith from 0.8.0 to 0.8.18 in /packages/bigframes
([#17518](#17518))
([f23063f](f23063f))
* bump msgpack from 1.1.1 to 1.2.1 in /packages/bigframes
([#17520](#17520))
([36b5b7e](36b5b7e))
* bump undici and @angular/build in
/packages/bigframes/bigframes/display/table_widget_angular
([#17519](#17519))
([6fc45e3](6fc45e3))
* handle empty endpoints during cloud function reuse
([#17501](#17501))
([4f5593a](4f5593a))


### Documentation

* ensure that PlotAccessor is included in the API reference
([#17513](#17513))
([6febabf](6febabf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.