Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: ignore warnings for duration in column summaries. (#10531)

Kyle Goodrick666e9223ff9c
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.py
index b9b70801e3..6c207c496e 100644
--- a/marimo/_plugins/ui/_impl/table.py
+++ b/marimo/_plugins/ui/_impl/table.py
@@ -1256,8 +1256,16 @@ class table(
continue
except BaseException as e:
bin_aggregation_failed = True
- LOGGER.warning(
- "Failed to get bin values for column %s: %s", column, e
+ # Duration/timedelta bins are unsupported by the charting
+ # path, so this expected failure does not emit a warning.
+ is_duration = external_type.startswith(
+ ("duration", "timedelta", "interval")
+ )
+ log = LOGGER.debug if is_duration else LOGGER.warning
+ log(
+ "Failed to get bin values for column %s: %s",
+ column,
+ e,
)
should_fallback = show_charts and bin_aggregation_failed
diff --git a/tests/_plugins/ui/_impl/test_table.py b/tests/_plugins/ui/_impl/test_table.py
index d292879932..bcbeb04668 100644
--- a/tests/_plugins/ui/_impl/test_table.py
+++ b/tests/_plugins/ui/_impl/test_table.py
@@ -2,7 +2,7 @@
from __future__ import annotations
import json
-from datetime import date
+from datetime import date, timedelta
from enum import Enum
from typing import TYPE_CHECKING, Any
from unittest.mock import patch
@@ -1402,6 +1402,23 @@ def test_show_column_summaries_disabled():
assert len(summaries.stats) == 0
+ not DependencyManager.polars.has(), reason="Polars is required"
+)
+def test_polars_duration_column_summaries_do_not_warn() -> None:
+ import polars as pl
+
+ data = pl.DataFrame(
+ {"duration": [timedelta(days=day) for day in range(1, 13)]}
+ )
+ table = ui.table(data, show_column_summaries=True)
+
+ with patch("marimo._plugins.ui._impl.table.LOGGER") as logger:
+ table._get_column_summaries(ColumnSummariesArgs())
+
+ logger.warning.assert_not_called()
+
+
@pytest.mark.skipif(
not DependencyManager.polars.has(), reason="Polars not installed"
)