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

Bug: Cannot perform division with '0' and '0' #3873

Open
2 tasks done
ioannist opened this issue Apr 15, 2024 · 1 comment
Open
2 tasks done

Bug: Cannot perform division with '0' and '0' #3873

ioannist opened this issue Apr 15, 2024 · 1 comment
Assignees
Labels
bug Something isn't working topic:surrealql This is related to the SurrealQL query language

Comments

@ioannist
Copy link

ioannist commented Apr 15, 2024

Describe the bug

Using aggregate views of mean() with GROUP BY, sometimes results in:
Error: There was a problem with the database: Cannot perform division with '0' and '0'

This seems to have been introduced in 1.4.0

Steps to reproduce

REMOVE TABLE happy;
REMOVE TABLE happy_aggr;
REMOVE TABLE happy_sums;
REMOVE TABLE happy_aggr2;

DEFINE TABLE happy_aggr AS select math::mean(val) as val, year, month, day FROM happy GROUP BY year, month, day;

DEFINE TABLE happy_sums AS select math::sum(val) as val, year, month, day FROM happy_aggr GROUP BY year, month, day;

DEFINE TABLE happy_sums AS select math::mean(val) as val, year, month, day FROM happy_sums GROUP BY year, month, day;

CREATE happy:10 SET year=2024, month=1, day=NONE, val=23;
CREATE happy:11 SET year=2024, month=1, day=NONE, val=23;
CREATE happy:12 SET year=2024, month=1, day=NONE, val=231231;

Expected behaviour

There is no division by zero in mean or sum, so there should be no division by zero error.

SurrealDB version

v1.4.0

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ioannist ioannist added bug Something isn't working triage This issue is new labels Apr 15, 2024
@phughk phughk added topic:surrealql This is related to the SurrealQL query language and removed triage This issue is new labels May 13, 2024
@phughk phughk assigned phughk and DelSkayn and unassigned phughk May 13, 2024
@phughk
Copy link
Contributor

phughk commented May 13, 2024

Hopefully this is just a simple check in the functions for empty sets. Otherwise I think the error for the other statements would be caused by the average statement triggering it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic:surrealql This is related to the SurrealQL query language
Projects
None yet
Development

No branches or pull requests

3 participants