feat(bigframes): Gcs bucket read will bind to gcs region if region unset#16855
feat(bigframes): Gcs bucket read will bind to gcs region if region unset#16855TrevorBergeron wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements automatic BigQuery location detection based on GCS bucket locations for various read functions and from_glob_path. It introduces a helper function to retrieve a storage client and logic to set the default session location if it hasn't been explicitly configured. Review feedback highlights a missing threading import and lock definition in the API module, as well as a case-sensitivity error in the new unit tests' assertions.
| global _default_location_lock | ||
|
|
||
| with _default_location_lock: |
There was a problem hiding this comment.
The variable _default_location_lock is used but not defined at the module level, and the threading module is not imported in this file. This will result in a NameError at runtime when _set_default_session_location_if_possible_gcs is called. Please define the lock at the module level (e.g., _default_location_lock = threading.Lock()) and ensure threading is imported.
|
|
||
| bf_io_api.read_csv("gs://test-bucket/file.csv") | ||
|
|
||
| assert config.options.bigquery.location == "EU" |
There was a problem hiding this comment.
The assertion expects "EU", but the location was set to "eu" at line 161. Since _set_default_session_location_if_possible_gcs returns early when a location is already set, the value will remain "eu", causing this test to fail. Based on the previous test case (line 148), locations appear to be case-sensitive in these assertions.
| assert config.options.bigquery.location == "EU" | |
| assert config.options.bigquery.location == "eu" |
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕