Skip to content

[BUG] Wrong behavior for RANK over() #8403

@comphead

Description

@comphead

Describe the bug

When working on #8386

RANK function gives wrong result or fails

To Reproduce

❯ select rank() over ()  from (select 1 a union all select 2 a) q;
Arrow error: Invalid argument error: number of columns(2) must match number of fields(1) in schema
❯ select rank() over (order by 1)  from (select 1 a union all select 2 a) q;
+----------------------------------------------------------------------------------------+
| RANK() ORDER BY [q.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
+----------------------------------------------------------------------------------------+
| 1                                                                                      |
| 2                                                                                      |
+----------------------------------------------------------------------------------------+

Expected behavior

It has to be

1
1

for both cases

Additional context

No response

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