Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling count function with a falsy where filter causes a runtime check error #57

Open
bob-pasabi opened this issue Jan 14, 2025 · 0 comments

Comments

@bob-pasabi
Copy link

When I try to run a count with a by and where clause and the where clause evaluates to false the code produces an error message from the runtime checks.

Contrived example

LET Ip := input();
LET ACondition := false;
LET TotalCount := count(BY Ip WHERE ACondition TOTAL);

Expected behavior

Should complete without issue and not add 1 to the count.

Actual behavior

Sqrl script runs fine but an error is printed out to the output

CodedError during sqrl execution:: arg error calling _bumpCount
arg 1: expected array

Steps to reproduce the behavior

Save the example and run

sqrl run test.sqrl -s 'Ip="1.2.3.6"' TotalCount

This appears to be caused by https://github.com/sqrl-lang/sqrl/blob/main/packages/sqrl-redis-functions/src/CountFunctions.ts#L260 which is expecting an array as the argument and null is getting passed during a false statement.

Not sure if I am doing something wrong with my setup or use, it's the first day I've tried to evaluate the library.

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

No branches or pull requests

1 participant