Skip to content
Merged
6 changes: 2 additions & 4 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,8 @@ def _read_pandas_inline(
try:
local_block = blocks.Block.from_local(pandas_dataframe, self)
inline_df = dataframe.DataFrame(local_block)
except pa.ArrowInvalid as e:
raise pa.ArrowInvalid(
f"Could not convert with a BigQuery type: `{e}`. "
) from e
except pa.ArrowInvalid: # Thrown by arrow for unsupported types, such as geo.
return None
except ValueError: # Thrown by ibis for some unhandled types
return None
except pa.ArrowTypeError: # Thrown by arrow for types without mapping (geo).
Expand Down
14 changes: 14 additions & 0 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pandas as pd
import pyarrow as pa # type: ignore
import pytest
import shapely # type: ignore

import bigframes.pandas
import bigframes.series as series
Expand Down Expand Up @@ -213,6 +214,19 @@ def test_series_construct_from_list_escaped_strings():
pd.testing.assert_series_equal(bf_result.to_pandas(), pd_result)


def test_series_construct_geodata():
pd_series = pd.Series(
[shapely.Point(1, 1), shapely.Point(2, 2), shapely.Point(3, 3)],
dtype=gpd.array.GeometryDtype(),
)

series = bigframes.pandas.Series(pd_series)

pd.testing.assert_series_equal(
pd_series, series.to_pandas(), check_index_type=False
)


@pytest.mark.parametrize(
["col_name", "expected_dtype"],
[
Expand Down