Skip to content

Conversation

@sanujbasu
Copy link
Collaborator

@sanujbasu sanujbasu commented Nov 3, 2025

This PR refactors the new_expression_evaluator and new_predicate_evaluator methods in the EvaluationHandler trait to return DeltaResult instead of being infallible. Addresses #566.

What changes are proposed in this pull request?

This is a breaking API change that enables:

  • Better error reporting at evaluator construction time rather than evaluation
  • Early validation of expression/predicate compatibility with input schemas
  • More idiomatic Rust error handling patterns

This PR affects the following public APIs

new_expression_evaluator and new_predicate_evaluator in EvaluationHandler

Changes:

  • Updated EvaluationHandler trait signatures to return DeltaResult<Arc<dyn Evaluator>>
  • Updated ArrowEvaluationHandler implementation to wrap returns in Ok(...)
  • Made ScanLogReplayProcessor::new fallible
  • Updated scan_action_iter to return DeltaResult<impl Iterator<...>>
  • Updated 12 callsites across the codebase to propagate errors with ? operator
  • Updated FFI layer to handle errors using ExternResult

How was this change tested?

  • All 630 existing kernel tests pass
  • All 18 FFI tests pass
  • Verified compilation with cargo check --all-features
  • No functional changes - purely refactoring error handling patterns

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 71.87500% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.97%. Comparing base (e8ca2f0) to head (d64cee7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kernel/src/scan/data_skipping.rs 65.00% 0 Missing and 7 partials ⚠️
kernel/src/scan/log_replay.rs 71.42% 0 Missing and 2 partials ⚠️
kernel/src/scan/mod.rs 33.33% 0 Missing and 2 partials ⚠️
ffi/src/engine_funcs.rs 91.66% 0 Missing and 1 partial ⚠️
kernel/src/engine/default/mod.rs 0.00% 0 Missing and 1 partial ⚠️
kernel/src/lib.rs 50.00% 0 Missing and 1 partial ⚠️
kernel/src/scan/state.rs 0.00% 0 Missing and 1 partial ⚠️
kernel/src/table_changes/log_replay.rs 0.00% 0 Missing and 1 partial ⚠️
kernel/src/table_changes/scan.rs 88.88% 0 Missing and 1 partial ⚠️
kernel/src/transaction/mod.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1452      +/-   ##
==========================================
- Coverage   85.00%   84.97%   -0.04%     
==========================================
  Files         120      120              
  Lines       31620    31641      +21     
  Branches    31620    31641      +21     
==========================================
+ Hits        26879    26886       +7     
+ Misses       3446     3445       -1     
- Partials     1295     1310      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added the breaking-change Change that require a major version bump label Nov 3, 2025
@sanujbasu sanujbasu force-pushed the fallible-evaluator-constructors branch from aecdadf to 9155ff7 Compare November 4, 2025 00:22
@sanujbasu sanujbasu force-pushed the fallible-evaluator-constructors branch 2 times, most recently from 9df0890 to ad74958 Compare November 4, 2025 09:05
Copy link
Collaborator

@scovich scovich left a comment

Choose a reason for hiding this comment

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

LGTM, couple questions that probably don't block merge

Comment on lines 147 to 148
.map_err(|e| error!("Failed to create select stats evaluator: {e}"))
.ok()?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting... this turns Result<T, Error> into Result<T, ()> and then returns None in case of Result::Err? That took a minute to grok.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll change these to inspect error which makes the intent clearer I guess

Comment on lines 163 to 167
.new_predicate_evaluator(stats_schema.clone(), FILTER_PRED.clone())
.ok()?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not log the error! here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack

@sanujbasu sanujbasu force-pushed the fallible-evaluator-constructors branch from ad74958 to da506b3 Compare November 5, 2025 22:38
This PR refactors the `new_expression_evaluator` and `new_predicate_evaluator`
methods in the `EvaluationHandler` trait to return `DeltaResult` instead of
being infallible.

This is a breaking API change that enables:
- Better error reporting at evaluator construction time rather than evaluation
- Early validation of expression/predicate compatibility with input schemas
- More idiomatic Rust error handling patterns

**Changes:**
- Updated `EvaluationHandler` trait signatures to return
	`DeltaResult<Arc<dyn Evaluator>>`
- Updated `ArrowEvaluationHandler` implementation to wrap returns in `Ok(...)`
- Made `ScanLogReplayProcessor::new` fallible
- Updated `scan_action_iter` to return `DeltaResult<impl Iterator<...>>`
- Updated 12 callsites across the codebase to propagate errors with `?` operator
- Updated FFI layer to handle errors through ExternResult

- All 630 existing kernel tests pass
- All 18 FFI tests pass
- Verified compilation with `cargo check --all-features`
- No functional changes - purely refactoring error handling patterns
@sanujbasu sanujbasu force-pushed the fallible-evaluator-constructors branch from da506b3 to d64cee7 Compare November 5, 2025 22:49
@sanujbasu sanujbasu merged commit 8589aa5 into delta-io:main Nov 5, 2025
20 of 22 checks passed
@sanujbasu sanujbasu deleted the fallible-evaluator-constructors branch November 5, 2025 23:04
aleksandarskrbic pushed a commit to aleksandarskrbic/delta-kernel-rs that referenced this pull request Nov 10, 2025
…elta-io#1452)

This PR refactors the `new_expression_evaluator` and
`new_predicate_evaluator` methods in the `EvaluationHandler` trait to
return `DeltaResult` instead of being infallible. Addresses
delta-io#566.

## What changes are proposed in this pull request?

This is a breaking API change that enables:
- Better error reporting at evaluator construction time rather than
evaluation
- Early validation of expression/predicate compatibility with input
schemas
- More idiomatic Rust error handling patterns

### This PR affects the following public APIs
`new_expression_evaluator` and `new_predicate_evaluator` in
`EvaluationHandler`


**Changes:**
- Updated `EvaluationHandler` trait signatures to return
`DeltaResult<Arc<dyn Evaluator>>`
- Updated `ArrowEvaluationHandler` implementation to wrap returns in
`Ok(...)`
- Made `ScanLogReplayProcessor::new` fallible
- Updated `scan_action_iter` to return `DeltaResult<impl Iterator<...>>`
- Updated 12 callsites across the codebase to propagate errors with `?`
operator
- Updated FFI layer to handle errors using ExternResult


## How was this change tested?
- All 630 existing kernel tests pass
- All 18 FFI tests pass
- Verified compilation with `cargo check --all-features`
- No functional changes - purely refactoring error handling patterns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Change that require a major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants