Skip to content

Commit c8a2355

Browse files
committed
fix non-monotonic
1 parent c969152 commit c8a2355

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)