Skip to content

[Bug] SELECT中存在多个 Window RANK 时,除第一个以外的RANK排序错误 #17635

@HuangYuChen1998

Description

@HuangYuChen1998

Search before asking

  • I searched in the issues and found nothing similar.

Version

版本:V2.0.8
系统 Windows 11

Describe the bug and provide the minimal reproduce step

SQL 如下:

select
    "time",
    symbol,
    display_name,
    close_hfq,
    RANK() OVER (ORDER BY "time" ASC) AS rank_time,
    RANK() OVER (ORDER BY close_hfq ASC) AS rank_close
FROM quant.stock_kline_weekly
WHERE "time" >= 2026-04-11
AND symbol = '600000'
ORDER BY rank_close ASC;
Image

在一个SELECT中有多个开窗函数时(如 RANK),后续开窗函数的统计结果总是第一个开窗函数的结果;
如图片中所示:按 close rank的话得出的顺序完全是反的,这个结果总是和第一个rank一致(这里是time);

What did you expect to see?

每个RANK在计算时是根据其自身的条件来计算的

What did you see instead?

总是取自第一个RANK

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions