Skip to content

fix(bigquery): keep microsecond timestamps in to_polars - #12157

Closed
nil68657 wants to merge 1 commit into
ibis-project:mainfrom
nil68657:fix-bigquery-polars-timestamp-unit
Closed

nil68657 wants to merge 1 commit into
ibis-project:mainfrom
nil68657:fix-bigquery-polars-timestamp-unit

Conversation

@nil68657

Copy link
Copy Markdown

Description of changes

BigQuery returns DATETIME and TIMESTAMP values as microsecond Arrow
data, which to_pyarrow keeps. to_polars then cast the result to the
ibis schema, where a timestamp without a scale maps to Datetime("ns"),
so the columns came back as nanoseconds. Treat unscaled timestamps as
microseconds when converting a BigQuery result to polars.

Issues closed

This PR is a joint contribution from Nilanjan Chatterjee and Claude (Claude Opus 5.5, via Claude Code). Nilanjan chose the issue and directed the work; Claude reproduced the problem, wrote the change, its tests and this description.

Authored by Nilanjan Chatterjee (@nil68657).

BigQuery returns DATETIME and TIMESTAMP values as microsecond Arrow
data, which to_pyarrow keeps. to_polars then cast the result to the
ibis schema, where a timestamp without a scale maps to Datetime("ns"),
so the columns came back as nanoseconds. Treat unscaled timestamps as
microseconds when converting a BigQuery result to polars.

Fixes ibis-project#11790

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added tests Issues or PRs related to tests bigquery The BigQuery backend labels Oct 11, 2026
@deepyaman deepyaman added the maybe-ai Apply to low-effort autonomous PRs to automatically close them. label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This was marked as potentially AI generated and will be closed now. If this is an error, please provide additional details, make sure to read the docs about contributing and AI.

@github-actions github-actions Bot closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bigquery The BigQuery backend maybe-ai Apply to low-effort autonomous PRs to automatically close them. tests Issues or PRs related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: in bigquery to_polars doesn't respect timestamp units

2 participants