-
Notifications
You must be signed in to change notification settings - Fork 592
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
feat(expr): expression node level non-strict evaluation #12461
Conversation
1228c9d
to
53e13dc
Compare
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
53e13dc
to
f6c468b
Compare
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
a24495a
to
00a22aa
Compare
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
…apper Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
…apper Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Codecov Report
@@ Coverage Diff @@
## main #12461 +/- ##
==========================================
- Coverage 69.35% 69.35% -0.01%
==========================================
Files 1438 1439 +1
Lines 238668 238751 +83
==========================================
+ Hits 165535 165586 +51
- Misses 73133 73165 +32
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
LGTM
/// A dummy implementation that panics when called. | ||
impl EvalErrorReport for ! { | ||
fn report(&self, _error: ExprError) { | ||
unreachable!() | ||
} | ||
} |
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.
Could you explain a little bit on this?
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.
_ctx: &ActorContextRef, | ||
_identity: &str, |
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.
What about just removing these arguments? Also elsewhere.
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.
Okay. I'll remove all function parameters but keep the existing ones in the executor body for potential future use. 😄
let eval_error_report = ActorEvalErrorReport { | ||
actor_context: ctx.clone(), | ||
identity: info.identity.into(), | ||
}; |
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.
Since we are providing identity
and eval_error_report
etc in params
, what about passing in eval_error_report
when new
?
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 the fields here are somehow redundant. Either LGTM. 🥹
src/expr/src/expr/build.rs
Outdated
impl ExprBuilder<!> { | ||
/// Create a new builder in strict mode. | ||
fn new_strict() -> Self { | ||
Self { error_report: None } | ||
} | ||
} |
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.
What does impl ExprBuilder<!>
mean?
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.
We need to specify the generic type R: EvalErrorReport
even if we use None
for error_report
. However, since the concrete type does not matter in this case, we can simply use the "never type" !
.
src/expr/src/expr/build.rs
Outdated
fn build_inner(&self, prost: &ExprNode) -> Result<BoxedExpression> { | ||
use PbType as E; | ||
|
||
let build_child = |prost: &'_ ExprNode| self.build(prost); |
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.
Interesting
async fn eval(&self, input: &DataChunk) -> Result<ArrayRef> { | ||
Ok(match self.inner.eval(input).await { | ||
Ok(array) => array, | ||
Err(_e) => self.eval_chunk_infallible_by_row(input).await, | ||
}) | ||
} |
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.
So this function tries inner.eval
chunk, if failed, eval it row by row again? Is there a better option?
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.
Is there a better option?
Maybe. Assuming the evaluation error is rare, the current implementation works fine, so I didn't make any changes in this PR.
…apper Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao i@bugenzhao.comI hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
See #4625 for the background.
Follow-up of #12426, this PR introduces a new
NonStrict
wrapper that reports the evaluation error and pads withNULL
for the inner expression. The wrapper will be attached to every node in the expression tree, unlike the previouseval_infallible
function which only handles errors in the root node. This is more reasonable as the optimizer may transform the expression tree arbitrarily after #10812.As a result, the context for reporting errors will be passed in during the build phase.
Resolves #11586.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
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.