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
This repository was archived by the owner on May 7, 2026. It is now read-only.

refactor: fix ops.StrftimeOp, ops.ToDatetimeOp, ops.ToTimestampOp in sqlglot compiler#2297

Merged
chelsea-lin merged 2 commits into
maingoogleapis/python-bigquery-dataframes:mainfrom
main_chelsealin_todatelikegoogleapis/python-bigquery-dataframes:main_chelsealin_todatelikeCopy head branch name to clipboard
Nov 26, 2025
Merged

refactor: fix ops.StrftimeOp, ops.ToDatetimeOp, ops.ToTimestampOp in sqlglot compiler#2297
chelsea-lin merged 2 commits into
maingoogleapis/python-bigquery-dataframes:mainfrom
main_chelsealin_todatelikegoogleapis/python-bigquery-dataframes:main_chelsealin_todatelikeCopy head branch name to clipboard

Conversation

@chelsea-lin

Copy link
Copy Markdown
Contributor

This change aims to fix the to_datetime related tests failing in #2248.

Fixes internal issue 417774347 🦕

@chelsea-lin chelsea-lin requested a review from sycai November 26, 2025 00:45
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Nov 26, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_todatelike branch from 546607a to c99acc9 Compare November 26, 2025 00:53
@chelsea-lin chelsea-lin marked this pull request as ready for review November 26, 2025 00:57
@chelsea-lin chelsea-lin requested review from a team November 26, 2025 00:57
Comment on lines +44 to +45
if expr.dtype != dtypes.INT_DTYPE:
value = sge.Cast(this=value, to=sge.DataType(this="INT64"))

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.

Should we remove this branch? "to_timedelta" only supports int, float and timedelta inputs:

def output_type(self, *input_types: dtypes.ExpressionType) -> dtypes.ExpressionType:
if input_types[0] in (
dtypes.INT_DTYPE,
dtypes.FLOAT_DTYPE,
dtypes.TIMEDELTA_DTYPE,
):
return dtypes.TIMEDELTA_DTYPE
raise TypeError("expected integer or float input")

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.

Got it. Yeah, the logic are same but I just refactored it for more readable, after having these information. Thanks

@chelsea-lin chelsea-lin requested a review from sycai November 26, 2025 18:59
@chelsea-lin chelsea-lin merged commit 9e0f70b into main Nov 26, 2025
20 of 25 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_todatelike branch November 26, 2025 19:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.

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.