From ad58b510a76fe12617c8f0d18151ce2b09050798 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Thu, 4 Sep 2025 17:08:11 +0000 Subject: [PATCH] fix: Fix issue mishandling chunked array while loading data --- bigframes/core/local_data.py | 5 ++++- tests/system/small/test_dataframe.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bigframes/core/local_data.py b/bigframes/core/local_data.py index 958113dda3..c214d0bb7e 100644 --- a/bigframes/core/local_data.py +++ b/bigframes/core/local_data.py @@ -277,7 +277,10 @@ def _adapt_pandas_series( ) return pa.array(series, type=pa.string()), bigframes.dtypes.GEO_DTYPE try: - return _adapt_arrow_array(pa.array(series)) + pa_arr = pa.array(series) + if isinstance(pa_arr, pa.ChunkedArray): + return _adapt_chunked_array(pa_arr) + return _adapt_arrow_array(pa_arr) except pa.ArrowInvalid as e: if series.dtype == np.dtype("O"): try: diff --git a/tests/system/small/test_dataframe.py b/tests/system/small/test_dataframe.py index dce0a649f6..58bfc615ef 100644 --- a/tests/system/small/test_dataframe.py +++ b/tests/system/small/test_dataframe.py @@ -138,6 +138,16 @@ def test_df_construct_structs(session): ) +def test_df_construct_local_concat_pd(scalars_pandas_df_index, session): + pd_df = pd.concat([scalars_pandas_df_index, scalars_pandas_df_index]) + + bf_df = session.read_pandas(pd_df) + + pd.testing.assert_frame_equal( + bf_df.to_pandas(), pd_df, check_index_type=False, check_dtype=False + ) + + def test_df_construct_pandas_set_dtype(scalars_dfs): columns = [ "int64_too",