risingwave icon indicating copy to clipboard operation
risingwave copied to clipboard

The default framing option for over window with order by is different from PG

Open chenzl25 opened this issue 2 years ago • 3 comments

Describe the bug

The default framing option is RANGE UNBOUNDED PRECEDING in PG, but in RisingWave we use ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. There are some differences between them.

Error message/log

No response

To Reproduce

CREATE TABLE integers(i INTEGER);
INSERT INTO integers VALUES (1), (2), (3), (NULL);
select SUM(s1.i) OVER (partition by 'const_number' ORDER BY s1.i ) FROM integers s1, integers s2;

RisingWave result:

 sum
-----
   1
   2
   3
   4
   6
   8
  10
  12
  15
  18
  21
  24
  24
  24
  24
  24
(16 rows)

Expected behavior

 sum
-----
   4
   4
   4
   4
  12
  12
  12
  12
  24
  24
  24
  24
  24
  24
  24
  24
(16 rows)

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

chenzl25 avatar Aug 10 '23 08:08 chenzl25

I am not sure whether we should change the default behavior to be aligned with PG. What's the default behaivor of Flink?

fuyufjh avatar Sep 11 '23 07:09 fuyufjh

This is a known limitation, and we emphasized this in our doc https://docs.risingwave.com/docs/current/window-functions/#syntax. Will align with PG after implementing https://github.com/risingwavelabs/risingwave/issues/11109

stdrc avatar Sep 11 '23 07:09 stdrc

This issue has been open for 60 days with no activity.

If you think it is still relevant today, and needs to be done in the near future, you can comment to update the status, or just manually remove the no-issue-activity label.

You can also confidently close this issue as not planned to keep our backlog clean. Don't worry if you think the issue is still valuable to continue in the future. It's searchable and can be reopened when it's time. 😄

github-actions[bot] avatar Aug 01 '24 02:08 github-actions[bot]