Skip to content

feat: support DataFusion Expr in DeleteBuilder#6343

Open
wjones127 wants to merge 1 commit intolance-format:mainfrom
wjones127:feat/delete-expr
Open

feat: support DataFusion Expr in DeleteBuilder#6343
wjones127 wants to merge 1 commit intolance-format:mainfrom
wjones127:feat/delete-expr

Conversation

@wjones127
Copy link
Copy Markdown
Contributor

@wjones127 wjones127 commented Mar 30, 2026

Previously, DeleteBuilder only accepted SQL string predicates. Callers who already had a datafusion::logical_expr::Expr (e.g. from query planning) had to serialize it to a string only for it to be reparsed inside.

This adds DeleteBuilder::from_expr(dataset, expr) as a companion to the existing DeleteBuilder::new(dataset, sql), following the dual-input pattern already used in Scanner (filter vs filter_expr). Internally both paths store an ExprFilter and dispatch to the appropriate scanner method. The Operation::Delete { predicate } field serializes the expr via expr.to_string() when needed for transaction logging.

Closes #6339

Test plan

  • New test_delete_with_expr_filter test verifies expr-based deletion matches the equivalent SQL path
  • All existing delete tests pass unchanged

Previously, `DeleteBuilder` only accepted SQL string predicates, requiring
callers who already had a `datafusion::logical_expr::Expr` to serialize it
to a string only for it to be reparsed internally.

This adds `DeleteBuilder::from_expr(dataset, expr)` as a companion to the
existing `DeleteBuilder::new(dataset, sql)`, following the same dual-input
pattern already used in `Scanner` (`filter` vs `filter_expr`). Internally
both paths store an `ExprFilter` and dispatch to the appropriate scanner
method; the `Operation::Delete { predicate }` field serializes the expr via
`expr.to_string()` when needed.

Closes lance-format#6339

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the enhancement New feature or request label Mar 30, 2026
@wjones127 wjones127 marked this pull request as ready for review March 30, 2026 16:55
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/dataset/write/delete.rs 90.90% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: support datafusion expression for row deletions

1 participant