@@ -783,8 +783,7 @@ def __repr__(self) -> str:
783783
784784 opts = bigframes .options .display
785785 max_results = opts .max_rows
786-
787- # anywidget mode uses the same display logic as the "deferred" mode
786+ # anywdiget mode uses the same display logic as the "deferred" mode
788787 # for faster execution
789788 if opts .repr_mode in ("deferred" , "anywidget" ):
790789 return formatter .repr_query_job (self ._compute_dry_run ())
@@ -856,28 +855,14 @@ def _repr_html_(self) -> str:
856855
857856 from bigframes import display
858857
859- # The anywidget frontend doesn't support the db_dtypes JSON type, so
860- # convert to strings for display.
861- json_cols = [
862- series_name
863- for series_name , series in df .items ()
864- if bigframes .dtypes .contains_db_dtypes_json_dtype (series .dtype )
865- ]
866- if json_cols :
867- warnings .warn (
868- "Converting JSON columns to strings for display. "
869- "This is temporary and will be removed when the frontend supports JSON types."
870- )
871- for col in json_cols :
872- df [col ] = df [col ]._apply_unary_op (ops .json_ops .ToJSONString ())
873-
874858 # Always create a new widget instance for each display call
875859 # This ensures that each cell gets its own widget and prevents
876860 # unintended sharing between cells
877861 widget = display .TableWidget (df .copy ())
878862
879863 ipython_display (widget )
880864 return "" # Return empty string since we used display()
865+
881866 except (AttributeError , ValueError , ImportError ):
882867 # Fallback if anywidget is not available
883868 warnings .warn (
@@ -1963,22 +1948,7 @@ def _to_pandas_batches(
19631948 * ,
19641949 allow_large_results : Optional [bool ] = None ,
19651950 ) -> blocks .PandasBatches :
1966- # Workaround for PyArrow bug https://github.com/apache/arrow/issues/45262
1967- # JSON columns are not supported in to_pandas_batches
1968- json_cols = [
1969- str (col_name ) # Cast to string
1970- for col_name , dtype in self .dtypes .items ()
1971- if bigframes .dtypes .contains_db_dtypes_json_dtype (dtype )
1972- ]
1973-
1974- df = self
1975- if json_cols :
1976- # Convert JSON columns to strings before materialization
1977- df = df .copy ()
1978- for col in json_cols :
1979- df [col ] = df [col ].astype ("string" )
1980-
1981- return df ._block .to_pandas_batches (
1951+ return self ._block .to_pandas_batches (
19821952 page_size = page_size ,
19831953 max_results = max_results ,
19841954 allow_large_results = allow_large_results ,
0 commit comments