Skip to content
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

Evaluation error leading to skipped row rather than null column for generate_series stopping now #17489

Open
xiangjinwu opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels
type/bug Something isn't working
Milestone

Comments

@xiangjinwu
Copy link
Contributor

Describe the bug

When the underlying source is a table:

dev=> create table t (a int);
CREATE_TABLE

dev=> insert into t values (4), (9);
INSERT 0 2

dev=> create materialized view mv1 as select a / 0 as z from t;
CREATE_MATERIALIZED_VIEW
dev=> select * from mv;
 z 
---
  
  
(2 rows)

dev=> create materialized view mv2 as select 3 / 0 as z from t;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Expr error
  2: error while evaluating expression `general_div('3', '0')`
  3: Division by zero

The first mv fills null on each input row, while the second mv detects the constant error. This makes sense.

However, when the underlying source is the newly introduced generate_series(..., now(), ...):

dev=> create materialized view mv3 as select extract(epoch from t) / 0 as z from generate_series('2024-01-01'::timestamptz, now(), interval '1' month) as s(t);
NOTICE:  Your session timezone is UTC. It was used in the interpretation of timestamps and dates in your query. If this is unintended, change your timezone to match that of your data's with `set timezone = [timezone]` or rewrite your query with an explicit timezone conversion, e.g. with `AT TIME ZONE`.

CREATE_MATERIALIZED_VIEW
dev=> select * from mv;
 z 
---
  
  
  
  
  
  
(6 rows)

dev=> create materialized view mv as select 3 / 0 as z from generate_series('2024-01-01'::timestamptz, now(), interval '1' month);
NOTICE:  Your session timezone is UTC. It was used in the interpretation of timestamps and dates in your query. If this is unintended, change your timezone to match that of your data's with `set timezone = [timezone]` or rewrite your query with an explicit timezone conversion, e.g. with `AT TIME ZONE`.

CREATE_MATERIALIZED_VIEW
dev=> select * from mv;
 z 
---
(0 rows)

In the former case, it fills null same as table above. But in the latter constant case, no error was returned and no rows with nulls are updated into the mv.

Error message/log

No response

To Reproduce

See description above.

Expected behavior

Either an immediate error, or 6 rows with null.

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

Inspired by #17461: after the column pruning fix, a constant error date 't' leads to an empty mv rather than an error or mv with 6 rows of nulls.

@xiangjinwu xiangjinwu added the type/bug Something isn't working label Jun 27, 2024
@github-actions github-actions bot added this to the release-1.10 milestone Jun 27, 2024
@xiangjinwu
Copy link
Contributor Author

@stdrc Any ideas why generate_series / NowExecutor is special here?

@fuyufjh fuyufjh modified the milestones: release-1.10, release-1.11 Jul 10, 2024
@stdrc stdrc modified the milestones: release-2.0, release-2.1 Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants