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

Internal Error in APPROX_PERCENTILE_CONT window function (SQLancer) #12058

Closed
2010YOUY01 opened this issue Aug 19, 2024 · 0 comments · Fixed by #12132
Closed

Internal Error in APPROX_PERCENTILE_CONT window function (SQLancer) #12058

2010YOUY01 opened this issue Aug 19, 2024 · 0 comments · Fixed by #12132
Assignees
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

Describe the bug

Using APPROX_PERCENTILE_CONT() aggregate as window function is supported now, but under certain case an internal error will be triggered.

See reproducer in datafusion-cli (compiled from latest main, commit is 574dfeb)

DataFusion CLI v41.0.0
> create table t1(v1 int);
insert into t1 values (1),(2),(3),(4),(5);
0 row(s) fetched.
Elapsed 0.108 seconds.

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

> SELECT
  APPROX_PERCENTILE_CONT(v1, 0.5) OVER (
    ROWS BETWEEN 4 PRECEDING AND CURRENT ROW
  )
FROM
  t1;
+-------------------------------------------------------------------------------------+
| approx_percentile_cont(t1.v1,Float64(0.5)) ROWS BETWEEN 4 PRECEDING AND CURRENT ROW |
+-------------------------------------------------------------------------------------+
| 1                                                                                   |
| 1                                                                                   |
| 2                                                                                   |
| 2                                                                                   |
| 3                                                                                   |
+-------------------------------------------------------------------------------------+
5 row(s) fetched.
Elapsed 0.040 seconds.

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

> SELECT
  APPROX_PERCENTILE_CONT(v1, 0.5) OVER (
    ROWS BETWEEN 4 PRECEDING AND CURRENT ROW
  )
FROM
  t1;
Internal error: Retract should be implemented for aggregate functions when used with custom window frame queries.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

To Reproduce

No response

Expected behavior

No response

Additional context

Found by SQLancer #11030

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

Successfully merging a pull request may close this issue.

2 participants