Skip to content

Feat/redisvl integration tests#2

Merged
rbs333 merged 3 commits into
mainfrom
feat/redisvl-integration-tests
Feb 2, 2026
Merged

Feat/redisvl integration tests#2
rbs333 merged 3 commits into
mainfrom
feat/redisvl-integration-tests

Conversation

@rbs333

@rbs333 rbs333 commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

This pr makes the following complete aggregation possible in RedisVL:

sql_str = """
    SELECT
        user,
        COUNT(age) as count_age,
        COUNT_DISTINCT(age) as count_distinct_age,
        MIN(age) as min_age,
        MAX(age) as max_age,
        AVG(age) as avg_age,
        STDEV(age) as std_age,
        FIRST_VALUE(age) as fist_value_age,
        ARRAY_AGG(age) as to_list_age,
        QUANTILE(age, 0.99) as quantile_age
    FROM user_simple
    GROUP BY credit_score
    """

sql_query = SQLQuery(sql_str)
redis_query = sql_query.redis_query_string(redis_url="redis://localhost:6379")
print("Resulting redis query: ", redis_query)
results = index.query(sql_query)
results

It adds support specifically for QUANTILE as well as fixes some parsing for STDEV, FIRST_VALUE, and ARRAY_AGG functionality. There was a bug where those were being added as apply statements instead of as reducers see: https://redis.slack.com/archives/C06R2N82D6E/p1769546814748909

@rbs333 rbs333 requested a review from abrookins January 29, 2026 15:27
Comment thread sql_redis/parser.py
function: str
field: str | None = None
alias: str | None = None
extra_args: list[str] = dataclasses.field(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quantile takes 2 arguments instead of 1 like the others

Comment thread sql_redis/parser.py
# Aggregation function
# Map sqlglot function names to Redis reducer names
func_name = expression.key.upper()
redis_func_map = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these to enable all available reducers from redis

Comment thread sql_redis/translator.py
if agg.field:
args.extend(["1", f"@{agg.field}"])
# COUNT always takes 0 arguments in Redis
if agg.function.upper() == "COUNT":

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count reducer had a bug because unlike the rest of the reducers it takes 0 args

@rbs333 rbs333 merged commit c36d851 into main Feb 2, 2026
8 checks passed
@rbs333 rbs333 deleted the feat/redisvl-integration-tests branch February 2, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant