8000 bug: can't correctly return NULL when rows satisfy `sum(...) filter (...)` are all deleted · Issue #7412 · risingwavelabs/risingwave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

bug: can't correctly return NULL when rows satisfy sum(...) filter (...) are all deleted #7412

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
stdrc opened this issue Jan 16, 2023 · 1 comment
Assignees
Labels
A-agg Area: Aggregate. P-low Priority: Low. type/bug Type: Bug. Only for issues.

Comments

@stdrc
Copy link
Member
stdrc commented Jan 16, 2023

Describe the bug

No response

To Reproduce

=> create table t (a int, b int);
=> create materialized view mv as select a, sum(b) filter (where b > 10) as sum from t group by a;

=> insert into t values (1, 1), (1, 11), (2, 14), (3, 0); flush;
=> select * from mv;
 a | sum
---+-----
 3 |       <- returned NULL correctly
 1 |  11
 2 |  14
(3 rows)

=> delete from t where a = 1 and b = 11; flush;
=> select * from mv;

 a | sum
---+-----
 3 |
 2 |  14
 1 |   0   <- incorrect
(3 rows)

Expected behavior

No response

Additional context

No response

@stdrc stdrc added the type/bug Type: Bug. Only for issues. label Jan 16, 2023
@github-actions github-actions bot added this to the release-0.1.16 milestone Jan 16, 2023
@stdrc
Copy link
Member Author
stdrc commented Jan 16, 2023
8000

According to some offline discussion:

  • If we want the result always compatible with PG, we have to insert row count column for each agg call with filter, which is hardly acceptable.
  • We can rewrite sum with filter to sum0, but that will make the results of sum w/ and w/o filter inconsistent.
  • We can rewrite all sum to sum0, but that will change existing behavior of sum.

@stdrc stdrc modified the milestones: release-0.1.17, release-0.1.18 Feb 15, 2023
@fuyufjh fuyufjh added the P-low Priority: Low. label Mar 22, 2023
@fuyufjh fuyufjh removed this from the release-0.18 milestone Mar 22, 2023
@stdrc stdrc added the A-agg Area: Aggregate. label May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-agg Area: Aggregate. P-low Priority: Low. type/bug Type: Bug. Only for issues.
Projects
None yet
Development

No branches or pull requests

2 participants
0