# Buggy code
def __call__(self, data, attribute):
    if type(data) == SqlTable:
        att = attribute.to_sql()
        quantiles = [(i + 1) / self.n for i in range(self.n - 1)]
        query = data._sql_query(
            ["quantile(%s, ARRAY%s)" % (att, str(quantiles))], use_time_sample=1000
        )
        with data._execute_sql_query(query) as cur:
            points = sorted(set(cur.fetchone()[0]))
    else:
        d = distribution.get_distribution(data, attribute)
        points = _discretize.split_eq_freq(d, self.n)
    return Discretizer.create_discretized_var(data.domain[attribute], points)


# Traceback (AssertionError)
Traceback (most recent call last):
File "/Users/ajda/opt/miniconda3/envs/o3/lib/python3.8/site-packages/orangewidget/gui.py", line 607, in eventFilter
self.__onEditingFinished()
File "/Users/ajda/opt/miniconda3/envs/o3/lib/python3.8/site-packages/orangewidget/gui.py", line 551, in __onEditingFinished
self.__commitValue(value)
File "/Users/ajda/opt/miniconda3/envs/o3/lib/python3.8/site-packages/orangewidget/gui.py", line 565, in __commitValue
self.cfunc()
File "/Users/ajda/opt/miniconda3/envs/o3/lib/python3.8/site-packages/orangewidget/gui.py", line 1923, in __call__
self.func(**kwds)
File "/Users/ajda/orange/orange3/Orange/widgets/data/owdiscretize.py", line 662, in _default_disc_changed
self._update_points()
File "/Users/ajda/orange/orange3/Orange/widgets/data/owdiscretize.py", line 599, in _update_points
points, dvar = induce_cuts(state.method, self.data, var)
File "/Users/ajda/orange/orange3/Orange/widgets/data/owdiscretize.py", line 585, in induce_cuts
dvar = _dispatch[type(method)](method, data, var)
File "/Users/ajda/orange/orange3/Orange/widgets/data/owdiscretize.py", line 48, in <lambda>
lambda m, data, var: _dispatch[type(m.method)](m.method, data, var),
File "/Users/ajda/orange/orange3/Orange/widgets/data/owdiscretize.py", line 51, in <lambda>
EqualFreq: lambda m, data, var: disc.EqualFreq(m.k)(data, var),
File "/Users/ajda/orange/orange3/Orange/preprocess/discretize.py", line 150, in __call__
return Discretizer.create_discretized_var(
File "/Users/ajda/orange/orange3/Orange/preprocess/discretize.py", line 71, in create_discretized_var
values = [
File "/Users/ajda/orange/orange3/Orange/preprocess/discretize.py", line 72, in <listcomp>
cls._fmt_interval(low, high, fmt)
File "/Users/ajda/orange/orange3/Orange/preprocess/discretize.py", line 53, in _fmt_interval
assert low is None or high is None or low < high
AssertionError

# Fixed code
def __call__(self, data, attribute):
    if type(data) == SqlTable:
        att = attribute.to_sql()
        quantiles = [(i + 1) / self.n for i in range(self.n - 1)]
        query = data._sql_query(
            ["quantile(%s, ARRAY%s)" % (att, str(quantiles))], use_time_sample=1000
        )
        with data._execute_sql_query(query) as cur:
            points = sorted(set(cur.fetchone()[0]))
    else:
        d = distribution.get_distribution(data, attribute)
        points = _discretize.split_eq_freq(d, self.n)
        # np.unique handles cases in which differences are below precision
        points = list(np.unique(points))
    return Discretizer.create_discretized_var(data.domain[attribute], points)