8000 Session windowing on streaming mode don't emit on window close · Issue #20834 · risingwavelabs/risingwave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Session windowing on streaming mode don't emit on window close #20834

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

Open
come-vitis-mox opened this issue Mar 11, 2025 · 1 comment
Open

Session windowing on streaming mode don't emit on window close #20834

come-vitis-mox opened this issue Mar 11, 2025 · 1 comment
Assignees
Labels
A-window-func Area: Window function, OverWindow. type/bug Type: Bug. Only for issues.

Comments

@come-vitis-mox
Copy link

Describe the bug

Using session window with emit on window mode is having keeping session open without closing them.
Source: Kafka
Materialized view emit on window mode.

Error message/log


To Reproduce

Table definition:

CREATE table events (
    *,
    WATERMARK FOR "requestedAt" AS "requestedAt" - INTERVAL '5 SECONDS'
)
APPEND ONLY
INCLUDE timestamp as kafka_timestamp
WITH (
  connector='kafka',
  topic='whatever.topic.name'
);

Materialized view:

CREATE MATERIALIZED VIEW session_window_mv
AS SELECT
    "customerId",
    "requestedAt",
    first_value("requestedAt") OVER (
        PARTITION BY "customerId" ORDER BY "requestedAt" ASC
        SESSION WITH GAP INTERVAL '5 SECONDS'
    ) AS first_event_time,
    last_value("requestedAt") OVER (
        PARTITION BY "customerId" ORDER BY "requestedAt" ASC
        SESSION WITH GAP INTERVAL '5 SECONDS'
    ) AS last_event_time
FROM events
EMIT ON WINDOW CLOSE;

Table (filtering on customer for specificity:

SELECT "customerId", "requestedAt", kafka_timestamp FROM pricing_data_session WHERE "customerId" = 'ABCD' ORDER BY "requestedAt" DESC;

     customerId      |          requestedAt          |        kafka_timestamp
---------------------+-------------------------------+-------------------------------
 ABCD | 2025-03-11 07:06:24.452+00:00 | 2025-03-11 07:06:24.463+00:00
 ABCD | 2025-03-11 06:58:27.694+00:00 | 2025-03-11 06:58:27.704+00:00
 ABCD | 2025-03-11 06:57:32.152+00:00 | 2025-03-11 06:57:32.245+00:00
 ABCD | 2025-03-11 03:17:05.430+00:00 | 2025-03-11 03:17:05.445+00:00

MV results (filtering on customer for specificity):

SELECT * FROM pricing_data_session_mv WHERE "customerId" = 'ABCD' ORDER BY last_event_time DESC;

     customerId      |          requestedAt          |       first_event_time        |        last_event_time
---------------------+-------------------------------+-------------------------------+-------------------------------
 ABCD | 2025-03-11 06:57:32.152+00:00 | 2025-03-11 06:57:32.152+00:00 | 2025-03-11 06:57:32.152+00:00
 ABCD | 2025-03-11 03:17:03.384+00:00 | 2025-03-11 03:17:03.384+00:00 | 2025-03-11 03:17:05.430+00:00

Expected behavior

SELECT
    "customerId",
    "requestedAt",
    first_value("requestedAt") OVER (
        PARTITION BY "customerId" ORDER BY "requestedAt"
        SESSION WITH GAP INTERVAL '5 SECONDS'
    ) AS first_event_time,
    last_value("requestedAt") OVER (
        PARTITION BY "customerId" ORDER BY "requestedAt"
        SESSION WITH GAP INTERVAL '5 SECONDS'
    ) AS last_event_time
FROM events
WHERE "customerId" = 'ABCD' 
ORDER BY last_event_time DESC;

     customerId      |          requestedAt          |       first_event_time        |        last_event_time
---------------------+-------------------------------+-------------------------------+-------------------------------
 ABCD | 2025-03-11 07:06:24.452+00:00 | 2025-03-11 07:06:24.452+00:00 | 2025-03-11 07:06:24.452+00:00
 ABCD | 2025-03-11 06:58:27.694+00:00 | 2025-03-11 06:58:27.694+00:00 | 2025-03-11 06:58:27.694+00:00
 ABCD | 2025-03-11 06:57:32.152+00:00 | 2025-03-11 06:57:32.152+00:00 | 2025-03-11 06:57:32.152+00:00
 ABCD | 2025-03-11 03:17:03.384+00:00 | 2025-03-11 03:17:03.384+00:00 | 2025-03-11 03:17:05.430+00:00

How did you deploy RisingWave?

helm on eks

The version of RisingWave

                                    version
--------------------------------------------------------------------------------
 PostgreSQL 13.14.0-RisingWave-2.2.1 (3bbe7ed3142c758e6c07dffddebd8f7a3bd3318d)

Additional context

No response

@come-vitis-mox come-vitis-mox added the type/bug Type: Bug. Only for issues. label Mar 11, 2025
@github-actions github-actions bot added this to the release-2.3 milestone Mar 11, 2025
@hzxa21
Copy link
Collaborator
hzxa21 commented Apr 25, 2025

@stdrc Can you take a look?

@hzxa21 hzxa21 removed this from the release-2.3 milestone Apr 25, 2025
@stdrc stdrc self-assigned this Apr 28, 2025
@stdrc stdrc added the A-window-func Area: Window function, OverWindow. label May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-window-func Area: Window function, OverWindow. type/bug Type: Bug. Only for issues.
Projects
None yet
Development

No branches or pull requests

3 participants
0