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.

use searched manager instead of manager for column charts get value counts (#7033)

Shahmir Varqha79c139437992
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.py
index eefeb4ecc4..4ed7056a2d 100644
--- a/marimo/_plugins/ui/_impl/table.py
+++ b/marimo/_plugins/ui/_impl/table.py
@@ -1060,7 +1060,7 @@ class table(
LOGGER.warning("Total rows and size is not valid")
return []
- top_k_rows = self._manager.calculate_top_k_rows(column, size)
+ top_k_rows = self._searched_manager.calculate_top_k_rows(column, size)
if len(top_k_rows) == 0:
return []
diff --git a/tests/_plugins/ui/_impl/test_table.py b/tests/_plugins/ui/_impl/test_table.py
index 3190578def..91e3ea9bb5 100644
--- a/tests/_plugins/ui/_impl/test_table.py
+++ b/tests/_plugins/ui/_impl/test_table.py
@@ -1088,6 +1088,18 @@ class TestTableGetValueCounts:
ValueCount(value="others", count=3),
]
+ def test_with_search(self, table: ui.table) -> None:
+ result = table._search(
+ SearchTableArgs(query="1", page_size=10, page_number=0)
+ )
+ rows = table._searched_manager.get_num_rows(force=True)
+ assert rows is not None
+ assert result.total_rows == 2
+ value_counts = table._get_value_counts(
+ column="repeat", size=2, total_rows=rows
+ )
+ assert value_counts == [ValueCount(value="1", count=2)]
+
def test_table_with_frozen_columns() -> None:
data = {