Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
brilee committed Jan 31, 2024
1 parent adb494c commit 41fb93a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lilac/data/dataset_duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 41fb93a

Please sign in to comment.