def _get_range_clause(column, value, bucket_interval):
    """Returns an SQL clause specifying that column is in the range
    specified by value. Uses bucket_interval to avoid potentially
    ambiguous ranges such as 1.0B-1.9B, which really means [1B, 2B).
    """
    if value[0] == '-':
        # avoid minus sign with split
        arr = value[1:].split('-', 1)
        arr[0] = '-' + arr[0]
    else:
        arr = value.split('-', 1)
    if len(arr) > 1:
        low = arr[0]
        high = arr[1]
    else:
        return column + " = " + value
    if low.endswith('M'):
        low = int(round(float(low[:-1]) * 1000000))
        high = low + bucket_interval
    elif low.endswith('B'):
        low = int(round(float(low[:-1]) * 1000000000))
        high = low + bucket_interval
    elif '.' not in low:
        low = int(low)
        high = low + bucket_interval

    # low is inclusive, high is exclusive
    # See https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_dsl/faceted_search.py#L125
    return column + " >= " + str(low) + " AND " + column + " < " + str(high)