Skip to content

Commit d7455a6

Browse files
committed
Fix testcase
1 parent 9b1fb93 commit d7455a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bigframes/core/blocks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,12 @@ def to_pandas_batches(
724724
safe_pa_type = bigframes.dtypes._replace_json_arrow_with_string(
725725
dtype.pyarrow_dtype
726726
)
727-
safe_dtype = pd.ArrowDtype(safe_pa_type)
728-
series_map[col] = pd.Series([], dtype=safe_dtype).astype(dtype)
727+
# Create empty array with safe type, but preserve original dtype metadata
728+
empty_array = pa.array([], type=safe_pa_type)
729+
series_map[col] = pd.Series(
730+
empty_array,
731+
dtype=dtype, # Use original dtype directly
732+
)
729733
else:
730734
# Fallback for other types that might error
731735
series_map[col] = pd.Series([], dtype="object").astype(dtype)

0 commit comments

Comments
 (0)