Skip to content

Commit 05e7a0a

Browse files
committed
Skip writing zero sized blocks to bigquery
1 parent aa2dede commit 05e7a0a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/ray/data/_internal/datasource/bigquery_datasink.py

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ def _write_single_block(block: Block, project_id: str, dataset: str) -> None:
7676
from google.cloud import bigquery
7777

7878
block = BlockAccessor.for_block(block).to_arrow()
79+
80+
if block.num_rows == 0:
81+
logger.info("Empty block detected. Skipping write to BigQuery.")
82+
return
7983

8084
client = bigquery_datasource._create_client(project_id=project_id)
8185
job_config = bigquery.LoadJobConfig(autodetect=True)

0 commit comments

Comments
 (0)