-
Notifications
You must be signed in to change notification settings - Fork 579
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
refactor(expr): don't fallback to evaluation by row on error #14174
Conversation
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Err(ExprError::Multiple(array, errors)) => { | ||
for error in errors { | ||
self.report.report(error); | ||
} | ||
array | ||
} | ||
Err(e) => { | ||
self.report.report(e); |
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.
Do we ensure that (almost) all Expression
s return Multiple
? Otherwise, all rows will be padded with NULL
once there's an error.
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.
Yes I have checked that. The remaining expressions not generated by #[function]
are not evaluated row by row, except for UDF, which I will fix 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.
It looks so fragile to me. 🥵
@@ -34,7 +34,8 @@ use crate::{bail, ExprError, Result}; | |||
|
|||
/// Build an expression from protobuf. | |||
pub fn build_from_prost(prost: &ExprNode) -> Result<BoxedExpression> { | |||
ExprBuilder::new_strict().build(prost) | |||
let expr = ExprBuilder::new_strict().build(prost)?; | |||
Ok(Strict::new(expr).boxed()) |
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.
Can we move this step into the ExprBuilder
?
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 wrapper is only needed at the top level. So I think no need to move it into the builder?
impl MultiExprError { | ||
/// Returns the first error. | ||
pub fn first(self) -> ExprError { | ||
self.0.into_vec().into_iter().next().expect("first error") |
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.
self.0.into_vec().into_iter().next().expect("first error") | |
self.0.into_iter().next().expect("first error") |
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.
If removed, the item would be &ExprError
. Seems to be a historical problem rust-lang/rust#59878
Signed-off-by: Runji Wang <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
resolve #14027 and replace #14147
This PR introduces a
MultiExprError
to collect function errors by each row. TheNonStrict
wrapper can identify this error and return partial results without falling back to evaluation row by row.Checklist
./risedev check
(or alias,./risedev c
)Documentation