-
Notifications
You must be signed in to change notification settings - Fork 590
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
fix(expr): tolerate table function errors on streams #17156
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e442caf
append error message to a third column for table functions
wangrunji0408 614f93a
remove Result from iterator item in `generate_series`
wangrunji0408 6458685
fix ProjectSet
wangrunji0408 fdc8a9b
handle errors in iteration
wangrunji0408 5e5e38f
fix clippy
wangrunji0408 b6972f3
format error as report
wangrunji0408 9b350e9
rename `capacity` to `item_capacity` in bytes and utf8 array builder
wangrunji0408 5ba9afd
fix unit test
wangrunji0408 f56b6d1
fix check
wangrunji0408 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# https://github.com/risingwavelabs/risingwave/issues/11915 | ||
|
||
statement ok | ||
create table t(x int); | ||
|
||
statement ok | ||
create materialized view mv as select x, generate_series(1, 2, x) from t; | ||
|
||
# x = 0 causes generate_series(1, 2, x) to return an error. | ||
statement ok | ||
insert into t values (0), (1); | ||
|
||
statement ok | ||
flush; | ||
|
||
# Output 0 row when the set-returning function returns error. | ||
query II rowsort | ||
select * from mv; | ||
---- | ||
1 1 | ||
1 2 | ||
|
||
# Delete the error row. | ||
statement ok | ||
delete from t where x = 0; | ||
|
||
statement ok | ||
flush; | ||
|
||
# The result should be the same as before. | ||
query II rowsort | ||
select * from mv; | ||
---- | ||
1 1 | ||
1 2 | ||
|
||
statement ok | ||
drop materialized view mv; | ||
|
||
statement ok | ||
drop table t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ impl ProjectSetExecutor { | |
&& i == row_idx | ||
{ | ||
valid = true; | ||
value | ||
value? | ||
} else { | ||
None | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an discussion on the behavior in this case. #12474 (comment) cc @fuyufjh
Not sure which one we should adopt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default behavior for a table function not being called (e.g. with null input) is returning no rows. So I vote for this for the sake of consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that these 2 cases should be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Option 1 in the original issue. And I agree it is consistent with null input. In other words, the table function returns
null
(which is similar to{}
but not{null}
) on error.Related edges cases on the differences among
null
,{}
and{null}
:array_agg
function on zero input rows return no rows withgroup by
, but anull
row with scalar agg. fix(optimizer): decorrelate SimpleAgg witharray_agg
/jsonb_agg
/jsonb_object_agg
#15590null
row. Array constructing subquery returning zero rows result in a{}
. fix(planner): array-construction subquery shall return{}
rather thannull
#15593^ Just mentioning these cases. Not suggesting any value is always preferred than the other 2.