Skip to content

Panic in scalar function approx_percentile_cont_with_weight (SQLancer) #12716

@2010YOUY01

Description

@2010YOUY01

Describe the bug

See the reproducer in datafusion-cli (compiled from the latest main, commit 0242767)

DataFusion CLI v42.0.0
> create table t1(v1 bool);
0 row(s) fetched.
Elapsed 0.065 seconds.

> insert into t1 values (true);
+-------+
| count |
+-------+
| 1     |
+-------+
1 row(s) fetched.
Elapsed 0.040 seconds.

> select approx_percentile_cont_with_weight('NaN'::Double, 0, 0) from t1 where t1.v1;
thread 'main' panicked at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/functions-aggregate-common/src/tdigest.rs:647:9:
assertion failed: max.total_cmp(&min).is_ge()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

No response

Expected behavior

It won't cause panic if from ... where ... is removed

DataFusion CLI v42.0.0
> select approx_percentile_cont_with_weight('NaN'::Double, 0, 0);
+-------------------------------------------------------------------+
| approx_percentile_cont_with_weight(Utf8("NaN"),Int64(0),Int64(0)) |
+-------------------------------------------------------------------+
| inf                                                               |
+-------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.099 seconds.

Additional context

Found by SQLancer #11030

Metadata

Metadata

Assignees

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