fix: support melting empty DataFrames without crashing (#2509) · googleapis/python-bigquery-dataframes@e8c4603 · GitHub
Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit e8c4603

Browse files
authored
fix: support melting empty DataFrames without crashing (#2509)
Allows alignment melts over zero-row offset layouts Fixes #<452681068> 🦕
1 parent b5a7652 commit e8c4603

3 files changed

Lines changed: 93 additions & 20 deletions

File tree

bigframes/core/blocks.py

Lines changed: 49 additions & 20 deletions

tests/system/small/test_dataframe.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5902,6 +5902,19 @@ def test_to_gbq_table_labels(scalars_df_index):
59025902
assert table.labels["test"] == "labels"
59035903

59045904

5905+
def test_to_gbq_obj_ref_persists(session):
5906+
# Test that saving and loading an Object Reference retains its dtype
5907+
bdf = session.from_glob_path(
5908+
"gs://cloud-samples-data/vision/ocr/*.jpg", name="uris"
5909+
).head(1)
5910+
5911+
destination_table = "bigframes-dev.bigframes_tests_sys.test_obj_ref_persistence"
5912+
bdf.to_gbq(destination_table, if_exists="replace")
5913+
5914+
loaded_df = session.read_gbq(destination_table)
5915+
assert loaded_df["uris"].dtype == dtypes.OBJ_REF_DTYPE
5916+
5917+
59055918
@pytest.mark.parametrize(
59065919
("col_names", "ignore_index"),
59075920
[

tests/system/small/test_multiindex.py

Lines changed: 31 additions & 0 deletions

0 commit comments

Comments
 (0)