From 41fb93aee7d5b3e408312188d118880852214625 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Wed, 31 Jan 2024 14:09:14 -0500 Subject: [PATCH] save --- lilac/data/dataset_duckdb.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lilac/data/dataset_duckdb.py b/lilac/data/dataset_duckdb.py index 48bbed67..23d38294 100644 --- a/lilac/data/dataset_duckdb.py +++ b/lilac/data/dataset_duckdb.py @@ -1933,6 +1933,7 @@ def select_groups( ORDER BY {sort_by.value} {sort_order.value}, {value_column} {limit_query} """ + print(query) df = self._query_df(query) counts = list(df.itertuples(index=False, name=None)) if is_temporal(leaf.dtype): @@ -3919,6 +3920,11 @@ def _auto_bins(stats: StatsResult, num_bins: int) -> list[Bin]: if stats.min_val is None or stats.max_val is None: return [('0', None, None)] + if stats.min_val == stats.max_val: + # Avoid division by zero when value_range = 0 + const_val = cast(float, stats.min_val) + return [('0', const_val, None)] + min_val = cast(float, stats.min_val) max_val = cast(float, stats.max_val) value_range = max_val - min_val