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

feat: make ExpressionHandler::get_evaluator fallible #577

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions kernel/src/scan/data_skipping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ impl DataSkippingFilter {
STATS_EXPR.clone(),
DataType::STRING,
)
.map_err(|e| {
warn!("Failed to create stats selector evaluator: {}", e);
e
})
.inspect_err(|e| warn!("Failed to create stats selector evaluator: {}", e))
.ok()?;
scovich marked this conversation as resolved.
Show resolved Hide resolved

let skipping_evaluator = engine
Expand All @@ -120,19 +117,13 @@ impl DataSkippingFilter {
Expr::struct_from([as_data_skipping_predicate(&predicate, false)?]),
PREDICATE_SCHEMA.clone(),
)
.map_err(|e| {
warn!("Failed to create skipping evaluator: {}", e);
e
})
.inspect_err(|e| warn!("Failed to create skipping evaluator: {}", e))
.ok()?;

let filter_evaluator = engine
.get_expression_handler()
.get_evaluator(stats_schema.clone(), FILTER_EXPR.clone(), DataType::BOOLEAN)
.map_err(|e| {
warn!("Failed to create filter evaluator: {}", e);
e
})
.inspect_err(|e| warn!("Failed to create filter evaluator: {}", e))
.ok()?;

Some(Self {
Expand Down
8 changes: 6 additions & 2 deletions kernel/src/scan/log_replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,16 @@ pub fn scan_action_iter(
SCAN_ROW_DATATYPE.clone(),
)?;

Ok(action_iter
let actions = action_iter
.map(move |action_res| {
let (batch, is_log_batch) = action_res?;
log_scanner.process_scan_batch(add_transform.as_ref(), batch.as_ref(), is_log_batch)
})
.filter(|res| res.as_ref().map_or(true, |(_, sv)| sv.contains(&true))))
.filter(|res: &Result<(Box<dyn EngineData>, Vec<bool>), Error>| {
scovich marked this conversation as resolved.
Show resolved Hide resolved
res.as_ref().map_or(true, |(_, sv)| sv.contains(&true))
});

Ok(actions)
}

#[cfg(test)]
Expand Down
Loading