feat(bigquery): Support queryResultsFormat and compressionCodec in query_and_wait()
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 Client.query_and_wait() 開始,接著追蹤 _job_helpers.py 中的 BigQuery 請求負載,以及 table.py 中的 RowIterator 與 Arrow 解析。比較相關的 PR 18027,並確認兩個選項都能被接受並傳送至 API,且壓縮的 Arrow 結果支援所述的 to_arrow() 與 to_dataframe() 使用情境。
由索引模型根據 Issue 內容生成。
描述
Determine this is the right repository
- I determined this is the correct repository in which to report this feature request.
Summary of the feature request
Feature Description
Add support for query_results_format (e.g., "ARROW") and compression_codec (e.g., "LZ4_FRAME") in Client.query_and_wait() and related job helper functions in google-cloud-bigquery.
Use Case & Problem Statement
Currently, Client.query_and_wait() executes a query and fetches results, but does not allow callers to request the underlying query results format as Apache Arrow streams or specify compression options directly during the fetch process.
For high-performance data processing pipelines using Apache Arrow or PyArrow, requesting query results in Arrow format with compression significantly reduces network payload size, deserialization overhead, and total query result fetch latency.
Proposed Solution
- Update
google.cloud.bigquery.client.Client.query_and_wait()to accept optional parameters:query_results_format: Optional string specifying result serialization format (e.g."ARROW").compression_codec: Optional string specifying compression algorithm
- Update underlying helper functions in
_job_helpers.pyto populate these options in the request payload sent to the BigQuery API. - Update
RowIteratorand Arrow parsing logic intable.pyto seamlessly handle Arrow record batch streams whenquery_results_format="ARROW"is specified.
Alternative Approaches Considered
- Manually constructing custom
QueryJobinstances and extracting Arrow record batches post-execution, which requires boilerplate code and loses the convenience ofquery_and_wait().
Additional Context
Related PR: https://github.com/googleapis/google-cloud-python/pull/18027
Desired code experience
from google.cloud import bigquery
client = bigquery.Client()
query = "SELECT * FROM bigquery-public-data.usa_names.usa_1910_2013 LIMIT 10000"
Request query results directly in Apache Arrow format with LZ4_FRAME compression
results = client.query_and_wait(
query,
query_results_format="ARROW",
compression_codec="LZ4_FRAME",
)
Convert directly to PyArrow Table or Pandas DataFrame
arrow_table = results.to_arrow()
df = results.to_dataframe()
Expected results
- Client.query_and_wait() accepts query_results_format and compression_codec parameters.
- The BigQuery API receives these parameters in the job execution request.
- Query results are returned and parsed efficiently via compressed Apache Arrow streams into the resulting RowIterator / Arrow table without client errors.
API client name and version
No response
Use case
e.g. This feature would be useful in a scenario where I need to process large amounts of data efficiently.
Additional context
https://github.com/googleapis/google-cloud-python/pull/18027
- 主要語言
- Python
- 星號
- 5.4k
- 分支
- 1.8k
- 平均合併
- 2 天 7 小時
- 30 天內合併 PR
- 173
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googleapis/google-cloud-python 的其他 Issue
-
firestore: field path with a quoted name ending in a backslash is misparsed可能已有人在做 @sebxt 於 25 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
googleapis/google-cloud-python#18771 ·
維護者通常 1 天內回覆
-
api: spanner type: feature request
難度 2/5 1-3 小時 新手友好度 68/100
googleapis/google-cloud-python#18584 ·
維護者通常 1 天內回覆
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegation可能已有人在做 @Om-singhaI 於 55 天前認領。 未關閉auth priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 88/100
googleapis/google-cloud-python#18428 ·
維護者通常 1 天內回覆
-
A client called `run_in_transaction` be stuck if Spanner is down可能已有人在做 @founderinaction 於 7 天前認領。 未關閉priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 72/100
googleapis/google-cloud-python#18375 · 1 則留言 ·
維護者通常 1 天內回覆
-
ci: enable --strict flag in presubmit twine_check可能重新可做 @ohmayr 於 44 天前認領,目前沒有進行中的 PR。 未關閉
難度 1/5 1 小時以內 新手友好度 76/100
googleapis/google-cloud-python#18339 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 googleapis/google-cloud-python 的全部 Issue
相似的 Issue
-
plot_graph crashes when a mesh node has no m2m edge可能已有人在做 @tygvi 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
mllam/neural-lam#883 · 1 則留言 ·
維護者通常 2 天內回覆
-
enhancement possible-duplicate
難度 1/5 1-3 小時 新手友好度 78/100
AOSSIE-Org/PictoPy#1715 · 2 則留言 ·
維護者通常 6 天內回覆
-
SQLite connector omits generated columns from the catalog, and drops relationships sourced on them未關閉
難度 2/5 1-3 小時 新手友好度 72/100
NVIDIA/auto-ontology#511 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
ethereum/execution-specs#3996 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
cpp-best-practices/project_validator#267 ·
維護者通常 1 天內回覆