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

fix(streaming): correctly skip problematic table-function input #19353

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Nov 12, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

See #19352. Close #19352.


The behavior for table function returning an error in streaming mode will become:

// When we encounter an error from one of the table functions,
//
// - if there are other successful table functions, `fully_consumed` will still be
// set to `false`, a `NULL` will be set in the output row for the failed table function,
// that's why we set `None` here.
//
// - if there are no other successful table functions (or we are the only table function),
// `fully_consumed` will be set to `true`, we won't output the row at all but skip
// the whole result set of the given row. Setting `None` here is no-op.

As described in #17156, there's currently a limitation that

If some rows have been output when the error occurs, these rows will not be reverted.

which behaves kind of strangely. Since it might be uncommon (?) for a table function to fail halfway, I prefer not to document this behavior.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link
Member Author

BugenZhao commented Nov 12, 2024

Comment on lines +188 to +189
// Whether all table functions has exhausted or has failed for current input row.
let mut fully_consumed = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case it's considered as "exhausted"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this condition doesn't meet:

if let Some((i, result)) = state.peek()
  && is_current_input(i)

i.e., the cursor of the state has moved to the next input.

@BugenZhao BugenZhao added this pull request to the merge queue Nov 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 13, 2024
@BugenZhao BugenZhao added this pull request to the merge queue Nov 14, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 14, 2024
@BugenZhao BugenZhao enabled auto-merge November 14, 2024 06:38
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
@BugenZhao BugenZhao force-pushed the bz/project-set-error-fix-again branch from 1e85b92 to be37009 Compare November 15, 2024 05:50
@BugenZhao BugenZhao added this pull request to the merge queue Nov 15, 2024
Merged via the queue into main with commit ac6cb38 Nov 15, 2024
29 of 30 checks passed
@BugenZhao BugenZhao deleted the bz/project-set-error-fix-again branch November 15, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: streaming table function result missing if other input rows lead to error
2 participants