risingwavelabs / risingwave

Best-in-class stream processing, analytics, and management. Perform continuous analytics, or build event-driven applications, real-time ETL pipelines, and feature stores in minutes. Unified streaming and batch. PostgreSQL compatible.
https://go.risingwave.com/slack
Apache License 2.0
7.07k stars 582 forks source link

duplicate rows displayed when select internal tables with limit #18694

Open ly9chee opened 2 months ago

ly9chee commented 2 months ago

Describe the bug

select * from __internal_xxx_8_source_2;

image

select * from __internal_xxx_8_source_2 limit 10;

image

Error message/log

No response

To Reproduce

No response

Expected behavior

No response

How did you deploy RisingWave?

No response

The version of RisingWave

PostgreSQL 13.14.0-RisingWave-2.0.0 (4c1649bef559adafe53b8efa0220de1b7a3c5f9a)

Additional context

No response

yihong0618 commented 2 months ago

seems its right when the limit number great than some number

when select * from __internal_xxx_8_source_2 limit 1000; the answer is right.

For the different query plan;

without limit:

dev=> explain select offset_info from __internal_ad_ctr_5_source_11;
                                  QUERY PLAN                                  
------------------------------------------------------------------------------
 BatchExchange { order: [], dist: Single }
 └─BatchScan { table: __internal_ad_ctr_5_source_11, columns: [offset_info] }
(2 rows)

limit 10:

dev=> explain select offset_info from __internal_ad_ctr_5_source_11 limit 10;
                                         QUERY PLAN                                          
---------------------------------------------------------------------------------------------
 BatchLimit { limit: 10, offset: 0 }
 └─BatchExchange { order: [], dist: Single, sequential: true }
   └─BatchLimit { limit: 10, offset: 0 }
     └─BatchScan { table: __internal_ad_ctr_5_source_11, columns: [offset_info], limit: 10 }
(4 rows)

limit 100:

dev=> explain select offset_info from __internal_ad_ctr_5_source_11 limit 100;
                                         QUERY PLAN                                         
--------------------------------------------------------------------------------------------
 BatchExchange { order: [], dist: Single }
 └─BatchLimit { limit: 100, offset: 0 }
   └─BatchScan { table: __internal_ad_ctr_5_source_11, columns: [offset_info], limit: 100 }
(3 rows)