Skip to content

Commit d7f16f9

Browse files
authored
Merge pull request #85 from YoungHypo/haibo/fix-non-monon
fix(histogram): Auto-fix non-monotonic buckets for equi-height
2 parents c969152 + c8a2355 commit d7f16f9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/sub_platforms/sql_opt/videx/videx_histogram.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ def model_post_init(self, __context: Any) -> None:
269269
monotonically_increasing = False
270270
break
271271
if not monotonically_increasing:
272-
# Currently, we can only handle the non-monotonically increasing issue for the singleton type.
273-
if self.histogram_type == 'singleton':
272+
# Handle non-monotonically increasing buckets by sorting them.
273+
# This can happen due to collation differences between database and Python.
274+
# For example, database may use case-insensitive collation while Python uses binary comparison.
275+
if self.histogram_type in ('singleton', 'equi-height'):
274276
# 1. Sort the buckets based on their min_value.
275277
# This puts the buckets in the correct monotonic order.
276278
self.buckets.sort(key=lambda b_: b_.min_value)

0 commit comments

Comments
 (0)