Skip to content

Commit 12e2a63

Browse files
committed
function call updated in
bigframes/core/blocks.py, unused function removed from bigframes/dtypes.py
1 parent 066b8d6 commit 12e2a63

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

bigframes/core/blocks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,7 @@ def to_pandas_batches(
721721
# db_dtypes.JSONArrowType, especially when nested.
722722
# Create with string type and then cast.
723723
if isinstance(dtype, pd.ArrowDtype):
724-
safe_pa_type = bigframes.dtypes._replace_json_arrow_with_string(
725-
dtype.pyarrow_dtype
726-
)
724+
safe_pa_type = bigframes.dtypes.to_storage_type(dtype.pyarrow_dtype)
727725
# Create empty array with safe type, but preserve original dtype metadata
728726
empty_array = pa.array([], type=safe_pa_type)
729727
series_map[col] = pd.Series(

bigframes/dtypes.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -972,21 +972,6 @@ def contains_db_dtypes_json_dtype(dtype):
972972
return contains_db_dtypes_json_arrow_type(dtype.pyarrow_dtype)
973973

974974

975-
def _replace_json_arrow_with_string(pa_type: pa.DataType) -> pa.DataType:
976-
"""Recursively replace JSONArrowType with string type."""
977-
if isinstance(pa_type, db_dtypes.JSONArrowType):
978-
return pa.string()
979-
if isinstance(pa_type, pa.ListType):
980-
return pa.list_(_replace_json_arrow_with_string(pa_type.value_type))
981-
if isinstance(pa_type, pa.StructType):
982-
new_fields = [
983-
field.with_type(_replace_json_arrow_with_string(field.type))
984-
for field in pa_type
985-
]
986-
return pa.struct(new_fields)
987-
return pa_type
988-
989-
990975
def warn_on_db_dtypes_json_dtype(dtypes):
991976
"""Warn that the JSON dtype is changing.
992977

0 commit comments

Comments
 (0)