Skip to content

Crash bug in APPROX_PERCENTILE_CONT_WITH_WEIGHT aggregate function (SQLancer) #11869

@2010YOUY01

Description

@2010YOUY01

Describe the bug

See full reproducer in datafusion-cli:

DataFusion CLI v40.0.0
> /*DML*/CREATE TABLE t1(v0 STRING, v1 BOOLEAN, v2 BOOLEAN);
/*DML*/INSERT INTO t1(v1, v0, v2) VALUES (true, '-1352499992', false);
/*DML*/INSERT INTO t1(v0) VALUES ('');
0 row(s) fetched.
Elapsed 0.058 seconds.

+-------+
| count |
+-------+
| 1     |
+-------+
1 row(s) fetched.
Elapsed 0.044 seconds.

+-------+
| count |
+-------+
| 1     |
+-------+
1 row(s) fetched.
Elapsed 0.005 seconds.

> SELECT APPROX_PERCENTILE_CONT_WITH_WEIGHT(
    -7,
    '+Inf'::Double,
    0.9
)
FROM t1;
thread 'main' panicked at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/num/f64.rs:1509:9:
min > max, or either was NaN. min = NaN, max = -7.0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

No response

Expected behavior

No response

Additional context

Found by SQLancer #11030

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions