Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 5 bigframes/core/compile/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ def _(
value = None
if expression.dtype is None:
return pl.lit(None)

# Polars lit does not handle pandas timedelta well at v1.36
if isinstance(value, pd.Timedelta):
value = value.to_pytimedelta()

return pl.lit(value, _bigframes_dtype_to_polars_dtype(expression.dtype))

@compile_expression.register
Expand Down
15 changes: 15 additions & 0 deletions 15 tests/unit/test_series_polars.py
Original file line number Diff line number Diff line change
Expand Up @@ -5109,3 +5109,18 @@ def test_series_item_with_empty(session):

with pytest.raises(ValueError, match=re.escape(expected_message)):
bf_s_empty.item()


def test_series_dt_total_seconds(scalars_df_index, scalars_pandas_df_index):
bf_result = scalars_df_index["duration_col"].dt.total_seconds().to_pandas()

pd_result = scalars_pandas_df_index["duration_col"].dt.total_seconds()

# Index will be object type in pandas, string type in bigframes, but same values
pd.testing.assert_series_equal(
bf_result,
pd_result,
check_index_type=False,
# bigframes uses Float64, newer pandas may use double[pyarrow]
check_dtype=False,
)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.