Skip to content

Bugs in LCM/GCD scalar functions (found by SQLancer) #11031

New issue

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

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

Already on GitHub? # to your account

Closed
2010YOUY01 opened this issue Jun 20, 2024 · 1 comment · Fixed by #11036
Closed

Bugs in LCM/GCD scalar functions (found by SQLancer) #11031

2010YOUY01 opened this issue Jun 20, 2024 · 1 comment · Fixed by #11036
Assignees
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

Describe the bug

  1. It should return an error instead of crash
> SELECT LCM(9223372036854775807, -9223372036854775808);
thread 'main' panicked at /arrow-datafusion/datafusion/functions/src/math/gcd.rs:112:9:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

DataFusion CLI v39.0.0
> SELECT GCD(9223372036854775807, -9223372036854775808);
thread 'main' panicked at /arrow-datafusion/datafusion/functions/src/math/gcd.rs:112:9:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  1. This query get stuck for really long time, but same query in duckdb can return immediately
DataFusion CLI v39.0.0
> select GCD(-9223372036854775808, 1);
^C

DataFusion CLI v39.0.0
> select LCM(-9223372036854775808, 1);
^C

Found by very initial implementation of SQLancer #11030

To Reproduce

No response

Expected behavior

No response

Additional context

No response

@2010YOUY01 2010YOUY01 added the bug Something isn't working label Jun 20, 2024
@LorrensP-2158466
Copy link
Contributor

take

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants