Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 8e0bde8

Browse files
unblock needed casts
1 parent dc8a634 commit 8e0bde8

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

bigframes/operations/generic_ops.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
dtypes.TIMESTAMP_DTYPE,
8686
dtypes.INT_DTYPE,
8787
),
88+
(
89+
dtypes.TIMEDELTA_DTYPE,
90+
dtypes.INT_DTYPE,
91+
),
8892
(
8993
dtypes.STRING_DTYPE,
9094
dtypes.INT_DTYPE,
@@ -132,6 +136,10 @@
132136
dtypes.BOOL_DTYPE,
133137
),
134138
# String casts
139+
(
140+
dtypes.BYTES_DTYPE,
141+
dtypes.STRING_DTYPE,
142+
),
135143
(
136144
dtypes.BOOL_DTYPE,
137145
dtypes.STRING_DTYPE,
@@ -164,6 +172,11 @@
164172
dtypes.JSON_DTYPE,
165173
dtypes.STRING_DTYPE,
166174
),
175+
# bytes casts
176+
(
177+
dtypes.STRING_DTYPE,
178+
dtypes.BYTES_DTYPE,
179+
),
167180
# decimal casts
168181
(
169182
dtypes.STRING_DTYPE,

bigframes/session/polars_executor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ def execute(
105105
if not self._can_execute(plan):
106106
return None
107107
# Note: Ignoring ordered flag, as just executing totally ordered is fine.
108-
try:
109-
lazy_frame: pl.LazyFrame = self._compiler.compile(
110-
array_value.ArrayValue(plan).node
111-
)
112-
except Exception:
113-
return None
108+
# try:
109+
lazy_frame: pl.LazyFrame = self._compiler.compile(
110+
array_value.ArrayValue(plan).node
111+
)
112+
# except Exception:
113+
# return None
114114
if peek is not None:
115115
lazy_frame = lazy_frame.limit(peek)
116116
pa_table = lazy_frame.collect().to_arrow()

tests/system/small/test_series.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,8 +3685,12 @@ def test_astype_numeric_to_int(scalars_df_index, scalars_pandas_df_index):
36853685
column = "numeric_col"
36863686
to_type = "Int64"
36873687
bf_result = scalars_df_index[column].astype(to_type).to_pandas()
3688-
# Round to the nearest whole number to avoid TypeError
3689-
pd_result = scalars_pandas_df_index[column].round(0).astype(to_type)
3688+
# Truncate to int to avoid TypeError
3689+
pd_result = (
3690+
scalars_pandas_df_index[column]
3691+
.apply(lambda x: None if pd.isna(x) else math.trunc(x))
3692+
.astype(to_type)
3693+
)
36903694
pd.testing.assert_series_equal(bf_result, pd_result)
36913695

36923696

0 commit comments

Comments
 (0)