Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This PR fixes two issues causing CI failures:

  1. Boolean Round Trip: Adjusted the expected DataFrame in test_dataframe_round_trip_with_table_schema to correctly handle pd.NA returned by the connector for nullable boolean values, instead of None.
  2. CSV Extreme Datetimes: Implemented cast_dataframe_for_csv to pre-format DATETIME and TIMESTAMP columns using .isoformat() before CSV serialization. This ensures years before 1000 are zero-padded (e.g., 0001-01-01), avoiding invalid date string errors from BigQuery when loading data.

PR created automatically by Jules for task 5793097527839411486 started by @chalmerlowe

- Fix `test_dataframe_round_trip_with_table_schema` failure by expecting `pd.NA` for boolean columns loaded as object, aligning with BigQuery Storage API behavior.
- Fix CSV loading failure for extreme datetimes (e.g., year 0001) by introducing `cast_dataframe_for_csv`. This helper forces `isoformat()` string conversion for DATETIME/TIMESTAMP columns, ensuring 4-digit years (e.g., `0001-01-01` instead of `1-01-01`) which prevents BigQuery BadRequest errors.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-pandas API. labels Dec 15, 2025
@chalmerlowe chalmerlowe changed the title Fix boolean round-trip test and CSV datetime loading errors fix: boolean round-trip test and CSV datetime loading errors Dec 15, 2025
google-labs-jules bot and others added 2 commits December 15, 2025 16:02
- Fix `test_dataframe_round_trip_with_table_schema` failure by expecting `pd.NA` for boolean columns loaded as object, aligning with BigQuery Storage API behavior.
- Fix CSV loading failure for extreme datetimes (e.g., year 0001) by introducing `cast_dataframe_for_csv`. This helper forces `isoformat()` string conversion for DATETIME/TIMESTAMP columns, ensuring 4-digit years (e.g., `0001-01-01` instead of `1-01-01`).
- `cast_dataframe_for_csv` is robust against non-datetime inputs (falls back to original value) and efficient (batch assigns new columns).
- Code formatting applied with `black`.
@chalmerlowe chalmerlowe self-assigned this Dec 15, 2025
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 15, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 15, 2025
Copy link
Collaborator

@chalmerlowe chalmerlowe left a comment

Choose a reason for hiding this comment

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

LGTM

@chalmerlowe chalmerlowe marked this pull request as ready for review December 15, 2025 20:40
@chalmerlowe chalmerlowe requested review from a team as code owners December 15, 2025 20:40
@chalmerlowe chalmerlowe merged commit d443103 into main Dec 15, 2025
26 of 28 checks passed
@chalmerlowe chalmerlowe deleted the fix-ci-errors-roundtrip-csv-datetime-5793097527839411486 branch December 15, 2025 20:40
daniel-sanche pushed a commit that referenced this pull request Dec 16, 2025
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:c8612d3fffb3f6a32353b2d1abd16b61e87811866f7ec9d65b59b02eb452a620
<details><summary>pandas-gbq: 0.32.0</summary>

##
[0.32.0](v0.31.1...v0.32.0)
(2025-12-15)

### Features

* Add support for Python 3.14 (#976)
([89b008d](89b008d8))

### Bug Fixes

* boolean round-trip test and CSV datetime loading errors (#1000)
([d443103](d4431030))

</details>
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-pandas API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants